Move the edge weight update handling to edge.c

This commit is contained in:
thorkill 2015-07-06 01:50:31 +02:00
parent 7c85db5421
commit 38c42fb973

View file

@ -336,19 +336,12 @@ void update_edge_weight(void) {
continue;
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,
c->edge->to->name,
c->edge->weight,
c->edge->avg_rtt*10);
/* avg_rtt is in ms */
c->edge->weight = c->edge->avg_rtt*10;
oldnode->data = c->edge;
splay_insert_node(edge_weight_tree, oldnode);
if (edge_update_weigth(c->edge, c->edge->avg_rtt*10))
send_add_edge(c, c->edge);
}
}