diff options
author | dimitri staessens <dimitri.staessens@ugent.be> | 2017-04-20 15:20:10 +0000 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-04-20 15:20:10 +0000 |
commit | 4bfd6c07281847405e127e9588376fcf20d07a7e (patch) | |
tree | 17b4f02e6802499ad51f4712104be4554f0c777e /src/ipcpd/normal/neighbors.c | |
parent | a3048addc6a6f4284ade5c024ae42db5719f509a (diff) | |
parent | b3f13ce940382cf449a244b2ff65dbf36ce2fe4b (diff) | |
download | ouroboros-4bfd6c07281847405e127e9588376fcf20d07a7e.tar.gz ouroboros-4bfd6c07281847405e127e9588376fcf20d07a7e.zip |
Merged in dstaesse/ouroboros/be-complete (pull request #489)
ipcpd: Build complete graph with gam
Diffstat (limited to 'src/ipcpd/normal/neighbors.c')
-rw-r--r-- | src/ipcpd/normal/neighbors.c | 22 |
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) { |