Move the edge weight update handling to edge.c
This commit is contained in:
parent
7c85db5421
commit
38c42fb973
1 changed files with 2 additions and 9 deletions
|
@ -336,20 +336,13 @@ void update_edge_weight(void) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c->edge->avg_rtt && (c->edge->weight != c->edge->avg_rtt*10)) {
|
if (c->edge->avg_rtt && (c->edge->weight != c->edge->avg_rtt*10)) {
|
||||||
splay_node_t *oldnode = splay_unlink(edge_weight_tree, c->edge);
|
|
||||||
if (!oldnode)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
logger(DEBUG_STATUS, LOG_INFO, "update_edge_weight(): %s -> %s (%d -> %d)", c->edge->from->name,
|
logger(DEBUG_STATUS, LOG_INFO, "update_edge_weight(): %s -> %s (%d -> %d)", c->edge->from->name,
|
||||||
c->edge->to->name,
|
c->edge->to->name,
|
||||||
c->edge->weight,
|
c->edge->weight,
|
||||||
c->edge->avg_rtt*10);
|
c->edge->avg_rtt*10);
|
||||||
|
|
||||||
/* avg_rtt is in ms */
|
if (edge_update_weigth(c->edge, c->edge->avg_rtt*10))
|
||||||
c->edge->weight = c->edge->avg_rtt*10;
|
send_add_edge(c, c->edge);
|
||||||
oldnode->data = c->edge;
|
|
||||||
splay_insert_node(edge_weight_tree, oldnode);
|
|
||||||
send_add_edge(c, c->edge);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue