From: Guus Sliepen Date: Sat, 27 Feb 2016 13:18:20 +0000 (+0100) Subject: Improve performance of edge updates. X-Git-Tag: release-1.1pre12~64 X-Git-Url: https://git.tinc-vpn.org/git/browse?a=commitdiff_plain;h=60fb2308e5bf1fd9ce642f6c4bcde81997593504;p=tinc Improve performance of edge updates. --- diff --git a/src/protocol_edge.c b/src/protocol_edge.c index c000ec05..5553f436 100644 --- a/src/protocol_edge.c +++ b/src/protocol_edge.c @@ -142,8 +142,19 @@ bool add_edge_h(connection_t *c, const char *request) { } else { logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) which does not match existing entry", "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(); + return true; } } else if(sockaddrcmp(&e->local_address, &local_address)) { if(from == myself) {