summaryrefslogtreecommitdiffstats
path: root/src/babel.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-08-03 03:18:54 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-08-03 03:18:54 +0200
commitb63b1bef96a3a089c5a95b47161dc620a6f82545 (patch)
treeb7f66fb4caa5fef3a4d797539938ba77b72c86e7 /src/babel.c
parent48f77c26dcb4a9e8d09e718f1b16e6b97c04d9b9 (diff)
downloadbabel-b63b1bef96a3a089c5a95b47161dc620a6f82545.tar
babel-b63b1bef96a3a089c5a95b47161dc620a6f82545.zip
Add a neighbour packet timeout to prevent new neighbours to be purged right after a route request has been received
Diffstat (limited to 'src/babel.c')
-rw-r--r--src/babel.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/babel.c b/src/babel.c
index 06c972f..3c0e219 100644
--- a/src/babel.c
+++ b/src/babel.c
@@ -60,7 +60,15 @@ static void maintain_neighbours(gmrf_context_t *ctx) {
gp_babel_neigh_t *neigh = *cur;
next = &neigh->next;
- if (gp_babel_neigh_get_rxcost(ctx, neigh) == GP_BABEL_INFINITY && gp_babel_neigh_get_txcost(ctx, neigh) == GP_BABEL_INFINITY && !neigh->ref) {
+ if ((gp_babel_neigh_get_rxcost(ctx, neigh) == GP_BABEL_INFINITY)
+ && (gp_babel_neigh_get_txcost(ctx, neigh) == GP_BABEL_INFINITY)
+ && (gp_babel_since(ctx, neigh->last_packet) > GP_BABEL_NEIGH_PACKET_TIMEOUT)
+ && !neigh->ref) {
+ gmrf_logf(ctx->gmrf, LOG_DEBUG, "maintenance: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x[%s]: expired (%ims since last packet)",
+ neigh->addr.d[0], neigh->addr.d[1], neigh->addr.d[2], neigh->addr.d[3],
+ neigh->addr.d[4], neigh->addr.d[5], neigh->addr.d[6], neigh->addr.d[7],
+ gmrf_iface_get_name(ctx->gmrf, iface->gmrf_iface), (int)gp_babel_since(ctx, neigh->last_packet)*10);
+
*cur = *next;
next = cur;
free(neigh);