summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2022-02-20 13:51:06 +0100
committerSander Vrijders <sander@ouroboros.rocks>2022-02-21 09:05:27 +0100
commitd30154086afa32df203606817ed4d614cbe37b31 (patch)
treedb9d7a45cee154a5d25905a8de67098888634573 /src
parent119ef2644639afba3324c3af9e422b90f81bdaf9 (diff)
downloadouroboros-d30154086afa32df203606817ed4d614cbe37b31.tar.gz
ouroboros-d30154086afa32df203606817ed4d614cbe37b31.zip
lib: Handle FLOWDOWN during blocking read
The blocking read from the rbuff was not correctly handling flow down states, returning a valid index. The attempt to fetch the header then failed on an assertion. The blocking read will now return -EFLOWDOWN if the flow is marked down by the IPCP. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src')
-rw-r--r--src/lib/shm_rbuff_pthr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/shm_rbuff_pthr.c b/src/lib/shm_rbuff_pthr.c
index cedbc7b1..5a3e8c42 100644
--- a/src/lib/shm_rbuff_pthr.c
+++ b/src/lib/shm_rbuff_pthr.c
@@ -203,9 +203,13 @@ ssize_t shm_rbuff_read_b(struct shm_rbuff * rb,
}
if (idx != -ETIMEDOUT) {
- idx = *tail_el_ptr(rb);
- *rb->tail = (*rb->tail + 1) & ((SHM_RBUFF_SIZE) - 1);
- pthread_cond_broadcast(rb->del);
+ if (*rb->acl & ACL_FLOWDOWN)
+ idx = -EFLOWDOWN;
+ else {
+ idx = *tail_el_ptr(rb);
+ *rb->tail = (*rb->tail + 1) & ((SHM_RBUFF_SIZE) - 1);
+ pthread_cond_broadcast(rb->del);
+ }
}
pthread_cleanup_pop(true);