summaryrefslogtreecommitdiff
path: root/src/irmd/api_table.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-12 16:15:46 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-12 22:19:50 +0100
commit98a15feabb6a14e52a54a09dfed58d55e0f99884 (patch)
tree0a67e3eb076558b6408d5744d74808e756e0639d /src/irmd/api_table.c
parent2ee140ec27335ca50e813080ee0e85e4ab86af37 (diff)
downloadouroboros-98a15feabb6a14e52a54a09dfed58d55e0f99884.tar.gz
ouroboros-98a15feabb6a14e52a54a09dfed58d55e0f99884.zip
irmd: Allow time for AP to call flow_accept()
When there is a burst of successive flow allocations for a certain name, each such request will block a thread in the IRMD for IRMD_REQ_ARR_TIMEOUT ms to allow the application some time to respond. This refactors some parts of the IRMd.
Diffstat (limited to 'src/irmd/api_table.c')
-rw-r--r--src/irmd/api_table.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/irmd/api_table.c b/src/irmd/api_table.c
index 7619fcf6..df300cea 100644
--- a/src/irmd/api_table.c
+++ b/src/irmd/api_table.c
@@ -159,16 +159,15 @@ int api_entry_sleep(struct api_entry * e)
e->state = API_SLEEP;
- while (e->state == API_SLEEP) {
- if ((ret = -pthread_cond_timedwait(&e->state_cond,
- &e->state_lock,
- &dl)) == -ETIMEDOUT) {
- break;
- }
- }
+ while (e->state == API_SLEEP && ret != -ETIMEDOUT)
+ ret = -pthread_cond_timedwait(&e->state_cond,
+ &e->state_lock,
+ &dl);
- if (e->state == API_DESTROY)
+ if (e->state == API_DESTROY) {
+ reg_entry_del_api(e->re, e->api);
ret = -1;
+ }
e->state = API_INIT;
pthread_cond_broadcast(&e->state_cond);