summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-03-30 22:22:33 +0200
committerdimitri staessens <dimitri.staessens@ugent.be>2017-03-30 22:27:39 +0200
commit4c9b3db27ac2c4f98ca16ad326c367653d97bfef (patch)
tree96fd37e505172ddeb99bc4072414d9b0783b150f
parentbce97d70ce43290f8351f34c763b30bfd73e6b99 (diff)
downloadouroboros-4c9b3db27ac2c4f98ca16ad326c367653d97bfef.tar.gz
ouroboros-4c9b3db27ac2c4f98ca16ad326c367653d97bfef.zip
ipcpd: Add missing lock in normal/neighbors
-rw-r--r--src/ipcpd/normal/neighbors.c7
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(&notify->next);
list_add(&notify->next, &nbs->notifiers);
pthread_mutex_unlock(&nbs->notifiers_lock);