Improve performance of edge updates.
This commit is contained in:
parent
994adadf27
commit
60fb2308e5
1 changed files with 12 additions and 1 deletions
|
@ -142,8 +142,19 @@ bool add_edge_h(connection_t *c, const char *request) {
|
||||||
} else {
|
} else {
|
||||||
logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) which does not match existing entry",
|
logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) which does not match existing entry",
|
||||||
"ADD_EDGE", c->name, c->hostname);
|
"ADD_EDGE", c->name, c->hostname);
|
||||||
edge_del(e);
|
e->options = options;
|
||||||
|
if(sockaddrcmp(&e->address, &address)) {
|
||||||
|
sockaddrfree(&e->address);
|
||||||
|
e->address = address;
|
||||||
|
}
|
||||||
|
if(e->weight != weight) {
|
||||||
|
avl_node_t *node = avl_unlink(edge_weight_tree, e);
|
||||||
|
e->weight = weight;
|
||||||
|
avl_insert_node(edge_weight_tree, node);
|
||||||
|
}
|
||||||
|
|
||||||
graph();
|
graph();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} else if(sockaddrcmp(&e->local_address, &local_address)) {
|
} else if(sockaddrcmp(&e->local_address, &local_address)) {
|
||||||
if(from == myself) {
|
if(from == myself) {
|
||||||
|
|
Loading…
Reference in a new issue