Reverted changes on EDGE_ADD update if weight differs

This commit is contained in:
thorkill 2015-07-09 17:33:17 +02:00
parent 0c30f9f0f1
commit 49cc329cf9

View file

@ -135,17 +135,7 @@ bool add_edge_h(connection_t *c, const char *request) {
e = lookup_edge(from, to); e = lookup_edge(from, to);
if(e) { if(e) {
/* Update weight first */ if(e->weight != weight || e->options != options || sockaddrcmp(&e->address, &address)) {
if(e->weight != weight){
logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) with new weight %d -> %d",
"ADD_EDGE", c->name, c->hostname, e->weight, weight);
edge_update_weigth(e, weight);
if (e->reverse)
edge_update_weigth(e->reverse, weight);
graph();
}
if(e->options != options || sockaddrcmp(&e->address, &address)) {
if(from == myself) { if(from == myself) {
logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) for ourself which does not match existing entry", logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) for ourself which does not match existing entry",
"ADD_EDGE", c->name, c->hostname); "ADD_EDGE", c->name, c->hostname);
@ -155,6 +145,14 @@ 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);
/* Update weight first */
if(e->weight != weight){
logger(DEBUG_PROTOCOL, LOG_WARNING, "Got %s from %s (%s) with new weight %d -> %d",
"ADD_EDGE", c->name, c->hostname, e->weight, weight);
//edge_update_weigth(e, weight);
//if (e->reverse)
// edge_update_weigth(e->reverse, weight);
}
edge_del(e); edge_del(e);
graph(); graph();
} }