summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-09-26 11:02:03 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2017-09-26 11:02:03 +0200
commit90900d36b7a380fee19b2171f4e49eed1eb35e8d (patch)
treec96e2be73ed64d85bc11bd5db8d8e7b1556d76d9
parentbaa9da56af12d14d63d504101c7efeb20da71a78 (diff)
downloadouroboros-90900d36b7a380fee19b2171f4e49eed1eb35e8d.tar.gz
ouroboros-90900d36b7a380fee19b2171f4e49eed1eb35e8d.zip
ipcpd: normal: Set clock to realtime clock
A pthread_cond_wait was using the pthread_cond_clock and thereby timing out constantly, consuming 100% CPU. This changes it to use the realtime clock.
-rw-r--r--src/ipcpd/normal/dht.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ipcpd/normal/dht.c b/src/ipcpd/normal/dht.c
index 4d0cdb02..b06c4480 100644
--- a/src/ipcpd/normal/dht.c
+++ b/src/ipcpd/normal/dht.c
@@ -2320,12 +2320,12 @@ static void * dht_handle_sdu(void * o)
struct cmd * cmd;
int ret = 0;
- clock_gettime(PTHREAD_COND_CLOCK, &dl);
+ clock_gettime(CLOCK_REALTIME_COARSE, &dl);
ts_add(&dl, &to, &dl);
pthread_mutex_lock(&dht->mtx);
- while(list_is_empty(&dht->cmds) && ret != -ETIMEDOUT)
+ while (list_is_empty(&dht->cmds) && ret != -ETIMEDOUT)
ret = -pthread_cond_timedwait(&dht->cond,
&dht->mtx, &dl);
@@ -2400,7 +2400,7 @@ static void * dht_handle_sdu(void * o)
"DHT enrolment refused.");
break;
- }
+ }
if (msg->t_refresh != KAD_T_REFR) {
log_warn("Refresh time mismatch. "