Commit e8fe07f6 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Synchronise the smoothed metric when metric is infinite.

When a route is retracted, we want to switch to an alternate route
straight away even if the smoothed metric hasn't converged yet.
Setting the smoothed metric to infinity in this case makes this happen.
parent 9f152653
...@@ -611,10 +611,10 @@ route_smoothed_metric(struct babel_route *route) ...@@ -611,10 +611,10 @@ route_smoothed_metric(struct babel_route *route)
{ {
int metric = route_metric(route); int metric = route_metric(route);
if(smoothing_half_life <= 0 || if(smoothing_half_life <= 0 || /* no smoothing */
/* Protect against clock stepping. */ metric >= INFINITY || /* route retracted */
route->smoothed_metric_time > now.tv_sec || route->smoothed_metric_time > now.tv_sec || /* clock stepped */
route->smoothed_metric == metric) { route->smoothed_metric == metric) { /* already converged */
route->smoothed_metric = metric; route->smoothed_metric = metric;
route->smoothed_metric_time = now.tv_sec; route->smoothed_metric_time = now.tv_sec;
} else { } else {
......
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