diff options
author | Sander Vrijders <[email protected]> | 2016-05-29 10:52:56 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-05-29 10:52:56 +0200 |
commit | 81cdb27742f9ae93169b0b03d1a45090c4354f89 (patch) | |
tree | 27d596fc4403363cfda9af734fc54edfad5258bd /src/ipcpd | |
parent | 06549f99edb0e25575487c3f76a6c76efa6e4017 (diff) | |
parent | 466fa24d57059aa87f432811eedae7b2a61e97d5 (diff) | |
download | ouroboros-81cdb27742f9ae93169b0b03d1a45090c4354f89.tar.gz ouroboros-81cdb27742f9ae93169b0b03d1a45090c4354f89.zip |
Merged in dstaesse/ouroboros/be-rbuff-sleep (pull request #120)
lib: shm_ap_rbuff: sleep when read on empty rbuff
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/local/main.c | 11 | ||||
-rw-r--r-- | src/ipcpd/shim-udp/main.c | 12 |
2 files changed, 10 insertions, 13 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index b07b0a52..4a0ad683 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -201,6 +201,11 @@ static void * ipcp_local_sdu_loop(void * o) struct rb_entry * e; int fd; + e = shm_ap_rbuff_read(_ap_instance->rb); + if (e == NULL) { + continue; + } + rw_lock_rdlock(&_ipcp->state_lock); if (_ipcp->state != IPCP_ENROLLED) { @@ -208,12 +213,6 @@ static void * ipcp_local_sdu_loop(void * o) return (void *) 1; /* -ENOTENROLLED */ } - e = shm_ap_rbuff_read(_ap_instance->rb); - if (e == NULL) { - rw_lock_unlock(&_ipcp->state_lock); - continue; - } - rw_lock_rdlock(&_ap_instance->flows_lock); fd = _ap_instance->in_out[port_id_to_fd(e->port_id)]; if (fd == -1) { diff --git a/src/ipcpd/shim-udp/main.c b/src/ipcpd/shim-udp/main.c index c6c16ebf..48fa141e 100644 --- a/src/ipcpd/shim-udp/main.c +++ b/src/ipcpd/shim-udp/main.c @@ -775,6 +775,11 @@ static void * ipcp_udp_sdu_loop(void * o) int len = 0; char * buf; + e = shm_ap_rbuff_read(_ap_instance->rb); + if (e == NULL) { + continue; + } + rw_lock_rdlock(&_ipcp->state_lock); if (_ipcp->state != IPCP_ENROLLED) { @@ -782,13 +787,6 @@ static void * ipcp_udp_sdu_loop(void * o) return (void *) 1; /* -ENOTENROLLED */ } - e = shm_ap_rbuff_read(_ap_instance->rb); - - if (e == NULL) { - rw_lock_unlock(&_ipcp->state_lock); - continue; - } - len = shm_du_map_read_sdu((uint8_t **) &buf, _ap_instance->dum, e->index); |