summaryrefslogtreecommitdiff
path: root/src/lib/shm_ap_rbuff.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-10-06 17:05:46 +0200
committerdimitri staessens <[email protected]>2016-10-06 17:05:46 +0200
commitaa0eac4f93b80537d02123715842d594a8ff3aad (patch)
tree671b0562b1b0f99e5565541315d2aa22e4b13955 /src/lib/shm_ap_rbuff.c
parenta4672940dc1effa40d2debf046c98708a831e928 (diff)
downloadouroboros-aa0eac4f93b80537d02123715842d594a8ff3aad.tar.gz
ouroboros-aa0eac4f93b80537d02123715842d594a8ff3aad.zip
lib: Fix shutdown with pending SDUs
The SDU's were not correctly removed upon shutdown, peek should be pop.
Diffstat (limited to 'src/lib/shm_ap_rbuff.c')
-rw-r--r--src/lib/shm_ap_rbuff.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/shm_ap_rbuff.c b/src/lib/shm_ap_rbuff.c
index 184a1bf2..acbc81a6 100644
--- a/src/lib/shm_ap_rbuff.c
+++ b/src/lib/shm_ap_rbuff.c
@@ -294,7 +294,7 @@ int shm_ap_rbuff_write(struct shm_ap_rbuff * rb, struct rb_entry * e)
return 0;
}
-int shm_ap_rbuff_peek_idx(struct shm_ap_rbuff * rb)
+int shm_ap_rbuff_pop_idx(struct shm_ap_rbuff * rb)
{
int ret = 0;
@@ -315,6 +315,8 @@ int shm_ap_rbuff_peek_idx(struct shm_ap_rbuff * rb)
ret = tail_el_ptr(rb)->index;
+ *rb->ptr_head = (*rb->ptr_head + 1) & (SHM_BUFFER_SIZE -1);
+
pthread_mutex_unlock(rb->lock);
return ret;