diff options
author | dimitri staessens <[email protected]> | 2017-03-30 22:22:33 +0200 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-03-30 22:27:39 +0200 |
commit | 4c9b3db27ac2c4f98ca16ad326c367653d97bfef (patch) | |
tree | 96fd37e505172ddeb99bc4072414d9b0783b150f /src/ipcpd | |
parent | bce97d70ce43290f8351f34c763b30bfd73e6b99 (diff) | |
download | ouroboros-4c9b3db27ac2c4f98ca16ad326c367653d97bfef.tar.gz ouroboros-4c9b3db27ac2c4f98ca16ad326c367653d97bfef.zip |
ipcpd: Add missing lock in normal/neighbors
Diffstat (limited to 'src/ipcpd')
-rw-r--r-- | src/ipcpd/normal/neighbors.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ipcpd/normal/neighbors.c b/src/ipcpd/normal/neighbors.c index d50732cb..f52a2319 100644 --- a/src/ipcpd/normal/neighbors.c +++ b/src/ipcpd/normal/neighbors.c @@ -40,12 +40,16 @@ static void notify_listeners(enum nb_event event, { struct list_head * p = NULL; + pthread_mutex_lock(&nbs->notifiers_lock); + list_for_each(p, &nbs->notifiers) { struct nb_notifier * e = list_entry(p, struct nb_notifier, next); if (e->notify_call(event, nb->conn)) log_err("Listener reported an error."); } + + pthread_mutex_unlock(&nbs->notifiers_lock); } struct nbs * nbs_create(void) @@ -106,8 +110,6 @@ int nbs_add(struct nbs * nbs, nb->conn = conn; - list_head_init(&nb->next); - pthread_mutex_lock(&nbs->list_lock); list_add(&nb->next, &nbs->list); @@ -183,7 +185,6 @@ int nbs_reg_notifier(struct nbs * nbs, pthread_mutex_lock(&nbs->notifiers_lock); - list_head_init(¬ify->next); list_add(¬ify->next, &nbs->notifiers); pthread_mutex_unlock(&nbs->notifiers_lock); |