summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/neighbors.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-04-20 16:52:23 +0200
committerdimitri staessens <[email protected]>2017-04-20 17:07:51 +0200
commitb3f13ce940382cf449a244b2ff65dbf36ce2fe4b (patch)
treea5a856f89fca7cf7074dc5427c8f8c08f62155bb /src/ipcpd/normal/neighbors.c
parent2a802888e91a274fa49d341da7744ea9c386b150 (diff)
downloadouroboros-b3f13ce940382cf449a244b2ff65dbf36ce2fe4b.tar.gz
ouroboros-b3f13ce940382cf449a244b2ff65dbf36ce2fe4b.zip
ipcpd: Build complete graph with gam
The complete policy will now build a complete graph. Currently a simple timer is used to check the member list periodically.
Diffstat (limited to 'src/ipcpd/normal/neighbors.c')
-rw-r--r--src/ipcpd/normal/neighbors.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/ipcpd/normal/neighbors.c b/src/ipcpd/normal/neighbors.c
index f52a2319..0dbc22f2 100644
--- a/src/ipcpd/normal/neighbors.c
+++ b/src/ipcpd/normal/neighbors.c
@@ -177,6 +177,28 @@ int nbs_del(struct nbs * nbs,
return -1;
}
+bool nbs_has(struct nbs * nbs,
+ uint64_t addr)
+{
+ struct list_head * p = NULL;
+
+ assert(nbs);
+
+ pthread_mutex_lock(&nbs->list_lock);
+
+ list_for_each(p, &nbs->list) {
+ struct nb * e = list_entry(p, struct nb, next);
+ if (e->conn.conn_info.addr == addr) {
+ pthread_mutex_unlock(&nbs->list_lock);
+ return true;
+ }
+ }
+
+ pthread_mutex_unlock(&nbs->list_lock);
+
+ return false;
+}
+
int nbs_reg_notifier(struct nbs * nbs,
struct nb_notifier * notify)
{