X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fedge.c;h=88847909c01b3fb9e31b19e5a08e1a444e293974;hb=158cbe99f972a1613b7d4d95abfe5fe48e019e67;hp=be1a6f3c8a57e07815b99fe5da1efe8e980da88a;hpb=0b8b23e0dd7219344543f135ca0aeba8a4a42d48;p=meshlink diff --git a/src/edge.c b/src/edge.c index be1a6f3c..88847909 100644 --- a/src/edge.c +++ b/src/edge.c @@ -1,7 +1,6 @@ /* edge.c -- edge tree management - Copyright (C) 2000-2006 Guus Sliepen , - 2000-2005 Ivo Timmermans + Copyright (C) 2014 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +20,6 @@ #include "system.h" #include "splay_tree.h" -#include "control_common.h" #include "edge.h" #include "logger.h" #include "netutl.h" @@ -29,7 +27,7 @@ #include "utils.h" #include "xalloc.h" -splay_tree_t *edge_weight_tree; /* Tree with all edges, sorted on weight */ +splay_tree_t *edge_weight_tree; static int edge_compare(const edge_t *a, const edge_t *b) { return strcmp(a->to->name, b->to->name); @@ -70,7 +68,7 @@ void exit_edges(void) { /* Creation and deletion of connection elements */ edge_t *new_edge(void) { - return xmalloc_and_zero(sizeof(edge_t)); + return xzalloc(sizeof(edge_t)); } void free_edge(edge_t *e) { @@ -99,24 +97,9 @@ void edge_del(edge_t *e) { edge_t *lookup_edge(node_t *from, node_t *to) { edge_t v; - + v.from = from; v.to = to; return splay_search(from->edge_tree, &v); } - -bool dump_edges(connection_t *c) { - for splay_each(node_t, n, node_tree) { - for splay_each(edge_t, e, n->edge_tree) { - char *address = sockaddr2hostname(&e->address); - send_request(c, "%d %d %s %s %s %x %d", - CONTROL, REQ_DUMP_EDGES, - e->from->name, e->to->name, address, - e->options, e->weight); - free(address); - } - } - - return send_request(c, "%d %d", CONTROL, REQ_DUMP_EDGES); -}