summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-10-07 11:20:49 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-10-07 11:20:49 +0000
commit281eaf854247703ed36725ab9dbef3a11d860c5c (patch)
treed78973cb327169e81c92f77a33cf5257d5195909
parent51fee46f023ecc05918c3b40cbef90af705b0fe8 (diff)
parent15ccd8ac0d1a7bfab2db3929200f3926c1e05db2 (diff)
downloadouroboros-281eaf854247703ed36725ab9dbef3a11d860c5c.tar.gz
ouroboros-281eaf854247703ed36725ab9dbef3a11d860c5c.zip
Merged in dstaesse/ouroboros/be-fix-ls (pull request #624)
ipcpd: Handle cancellation while writing LSAs
-rw-r--r--src/ipcpd/normal/pol/link_state.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ipcpd/normal/pol/link_state.c b/src/ipcpd/normal/pol/link_state.c
index f3af2771..9c41dba3 100644
--- a/src/ipcpd/normal/pol/link_state.c
+++ b/src/ipcpd/normal/pol/link_state.c
@@ -534,13 +534,16 @@ static void forward_lsm(uint8_t * buf,
pthread_rwlock_rdlock(&ls.db_lock);
+ pthread_cleanup_push((void (*))(void *) pthread_rwlock_unlock,
+ &ls.db_lock);
+
list_for_each(p, &ls.nbs) {
struct nb * nb = list_entry(p, struct nb, next);
if (nb->type == NB_MGMT && nb->fd != in_fd)
flow_write(nb->fd, buf, len);
}
- pthread_rwlock_unlock(&ls.db_lock);
+ pthread_cleanup_pop(true);
}
static void * lsreader(void * o)