summaryrefslogtreecommitdiff
path: root/src/ipcpd
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-03-31 09:22:33 +0000
committerSander Vrijders <[email protected]>2017-03-31 09:22:33 +0000
commit5f79a21b80e68ba59616f0fa431287c3e94c43cf (patch)
tree96fd37e505172ddeb99bc4072414d9b0783b150f /src/ipcpd
parentbce97d70ce43290f8351f34c763b30bfd73e6b99 (diff)
parent4c9b3db27ac2c4f98ca16ad326c367653d97bfef (diff)
downloadouroboros-5f79a21b80e68ba59616f0fa431287c3e94c43cf.tar.gz
ouroboros-5f79a21b80e68ba59616f0fa431287c3e94c43cf.zip
Merged in dstaesse/ouroboros/be-fix-nbs (pull request #440)
ipcpd: Add missing lock in normal/neighbors
Diffstat (limited to 'src/ipcpd')
-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);