Commit 16e1a45e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Avoid microoptimisation in route_changed.

This is brittle, and prevents me from making route selection smarter.
parent 1b2f8d62
......@@ -938,17 +938,15 @@ route_changed(struct babel_route *route,
struct source *oldsrc, unsigned short oldmetric)
{
if(route->installed) {
if(route_metric(route) > oldmetric) {
struct babel_route *better_route;
better_route =
find_best_route(route->src->prefix, route->src->plen, 1, NULL);
if(better_route &&
route_metric(better_route) <= route_metric(route) - 96)
consider_route(better_route);
}
struct babel_route *better_route;
/* Do this unconditionally -- microoptimisation is not worth it. */
better_route =
find_best_route(route->src->prefix, route->src->plen, 1, NULL);
if(better_route && route_metric(better_route) < route_metric(route))
consider_route(better_route);
if(route->installed)
/* We didn't change routes after all. */
/* We didn't switch to the better route. */
send_triggered_update(route, oldsrc, oldmetric);
} else {
/* Reconsider routes even when their metric didn't decrease,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment