Fixed edge->reverse corruption resulting in a segfault in graph()

Thanks to Guus for helping us with this one.
This commit is contained in:
thorkill 2015-07-05 20:54:32 +02:00
parent 04c1dedeb5
commit bebe8e6808

View file

@ -39,10 +39,12 @@
#include "route.h" #include "route.h"
#include "rsa.h" #include "rsa.h"
#include "script.h" #include "script.h"
#include "splay_tree.h"
#include "subnet.h" #include "subnet.h"
#include "utils.h" #include "utils.h"
#include "xalloc.h" #include "xalloc.h"
char *myport; char *myport;
static char *myname; static char *myname;
static io_t device_io; static io_t device_io;
@ -339,14 +341,11 @@ void update_edge_weight(void) {
c->edge->to->name, c->edge->to->name,
c->edge->weight, c->edge->weight,
c->edge->avg_rtt*10); c->edge->avg_rtt*10);
t = clone_edge(c->edge); splay_unlink(edge_weight_tree, c->edge);
send_del_edge(c, c->edge);
edge_del(c->edge);
/* avg_rtt is in ms */ /* avg_rtt is in ms */
t->weight = t->avg_rtt*10; c->edge->weight = c->edge->avg_rtt*10;
c->edge = t; splay_insert(edge_weight_tree, c->edge);
edge_add(t); send_add_edge(c, c->edge);
send_add_edge(c, t);
} }
} }
} }