summaryrefslogtreecommitdiff
path: root/src/ipcpd/local
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2017-09-19 14:53:11 +0000
committerdimitri staessens <[email protected]>2017-09-19 14:53:11 +0000
commit115431af51795dfd583e24a051a7749c58a900b3 (patch)
treea5817c5bd030b8a07713dcaa7dde95edbd0392d2 /src/ipcpd/local
parent669a8d4edfcc0fb2a7cd6f93e0ad2d0de820371a (diff)
parent541b1c5eeb5fe9f9aaa4aa6487852e5c59761139 (diff)
downloadouroboros-115431af51795dfd583e24a051a7749c58a900b3.tar.gz
ouroboros-115431af51795dfd583e24a051a7749c58a900b3.zip
Merged in sandervrijders/ouroboros/be-flow-down (pull request #596)
ipcpd, lib: Add flow down events
Diffstat (limited to 'src/ipcpd/local')
-rw-r--r--src/ipcpd/local/main.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index fb4e312b..7f44a2c6 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -99,30 +99,28 @@ static void * ipcp_local_sdu_loop(void * o)
(void) o;
- while (true) {
- int fd;
+ while (ipcp_get_state() == IPCP_OPERATIONAL) {
+ int fd;
ssize_t idx;
- if (ipcp_get_state() != IPCP_OPERATIONAL)
- return (void *) 1; /* -ENOTENROLLED */
-
fevent(local_data.flows, local_data.fq, &timeout);
while ((fd = fqueue_next(local_data.fq)) >= 0) {
- pthread_rwlock_rdlock(&local_data.lock);
-
idx = local_flow_read(fd);
+ if (idx < 0)
+ continue;
assert(idx < (SHM_BUFFER_SIZE));
+ pthread_rwlock_rdlock(&local_data.lock);
+
fd = local_data.in_out[fd];
+ pthread_rwlock_unlock(&local_data.lock);
+
if (fd != -1)
local_flow_write(fd, idx);
-
- pthread_rwlock_unlock(&local_data.lock);
}
-
}
return (void *) 0;