summaryrefslogtreecommitdiff
path: root/src/lib/shm_rbuff.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-11-29 22:30:56 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-11-30 09:29:40 +0100
commit0b6c8e3b7d10c44ccb5330a81e90cf1b4cae4dfb (patch)
tree1320c39d38bac8f665e70d7bb4e5fb7c572aeefb /src/lib/shm_rbuff.c
parent591d1aa7205f48c57d75fef56d18e1e67948af20 (diff)
downloadouroboros-0b6c8e3b7d10c44ccb5330a81e90cf1b4cae4dfb.tar.gz
ouroboros-0b6c8e3b7d10c44ccb5330a81e90cf1b4cae4dfb.zip
lib, irmd: Ensure rbuffs are empty upon destruction
Also cleans up the flow_set if an AP-I dies abruptly.
Diffstat (limited to 'src/lib/shm_rbuff.c')
-rw-r--r--src/lib/shm_rbuff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/shm_rbuff.c b/src/lib/shm_rbuff.c
index 1e97364c..5d6d30c7 100644
--- a/src/lib/shm_rbuff.c
+++ b/src/lib/shm_rbuff.c
@@ -224,9 +224,15 @@ void shm_rbuff_destroy(struct shm_rbuff * rb)
{
char fn[FN_MAX_CHARS];
- if (rb == NULL)
- return;
+ assert(rb);
+
+#ifdef CONFIG_OUROBOROS_DEBUG
+ pthread_mutex_lock(rb->lock);
+ assert(shm_rbuff_empty(rb));
+
+ pthread_mutex_unlock(rb->lock);
+#endif
sprintf(fn, SHM_RBUFF_PREFIX "%d.%d", rb->api, rb->port_id);
if (munmap(rb->shm_base, SHM_RBUFF_FILE_SIZE) == -1)