Don't purge route entries before the purge timeout has passed

This commit is contained in:
Matthias Schiffer 2013-08-04 01:51:06 +02:00
parent 8c43958511
commit 4b79b85e4e
2 changed files with 6 additions and 1 deletions

View file

@ -93,7 +93,11 @@ static void maintain_routes(gmrf_context_t *ctx) {
gp_babel_route_update(ctx, route); gp_babel_route_update(ctx, route);
if (!route->nexthops) { if (!route->nexthops && gp_babel_since(ctx, route->last_nexthop) > GP_BABEL_PURGE_TIMEOUT) {
gmrf_logf(ctx->gmrf, LOG_DEBUG, "node %04x%04x (%u, seqno=%04x): purging.",
ntohl(*(uint32_t*)route->node.id), ntohl(*(uint32_t*)(route->node.id+4)),
route->metric.metric, route->metric.seqno);
*cur = *next; *cur = *next;
next = cur; next = cur;
gp_babel_route_free(ctx, route); gp_babel_route_free(ctx, route);

View file

@ -45,6 +45,7 @@
#define GP_BABEL_UPDATE_REQUEST_TIMEOUT(interval) ((interval)*13/4) /* 3.25 intervals */ #define GP_BABEL_UPDATE_REQUEST_TIMEOUT(interval) ((interval)*13/4) /* 3.25 intervals */
#define GP_BABEL_MAINTENANCE_INTERVAL GP_BABEL_HELLO_INTERVAL #define GP_BABEL_MAINTENANCE_INTERVAL GP_BABEL_HELLO_INTERVAL
#define GP_BABEL_PURGE_TIMEOUT GP_BABEL_UPDATE_TIMEOUT(GP_BABEL_UPDATE_INTERVAL)
#define GP_BABEL_NEIGH_PACKET_TIMEOUT 6000 #define GP_BABEL_NEIGH_PACKET_TIMEOUT 6000