From b3f13ce940382cf449a244b2ff65dbf36ce2fe4b Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 20 Apr 2017 16:52:23 +0200 Subject: 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. --- src/ipcpd/normal/neighbors.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/ipcpd/normal/neighbors.c') 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) { -- cgit v1.2.3