X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconnection.c;h=4a2ba4c09110394e8654f4ecc3728484878ddf3f;hb=f1fec466e232c00c668422014029dce9114d3add;hp=84d2ac4de2f743fa6f106507794d35756266dd3e;hpb=046158a216e78a0412186ec8463157f6bce45d5d;p=tinc diff --git a/src/connection.c b/src/connection.c index 84d2ac4d..4a2ba4c0 100644 --- a/src/connection.c +++ b/src/connection.c @@ -37,7 +37,7 @@ splay_tree_t *connection_tree; /* Meta connections */ connection_t *broadcast; static int connection_compare(const connection_t *a, const connection_t *b) { - return (void *)a - (void *)b; + return a < b ? -1 : a == b ? 0 : 1; } void init_connections(void) { @@ -80,6 +80,9 @@ void free_connection(connection_t *c) { if(c->hischallenge) free(c->hischallenge); + if(c->config_tree) + exit_configuration(&c->config_tree); + if(c->buffer) bufferevent_free(c->buffer); @@ -110,9 +113,9 @@ int dump_connections(struct evbuffer *out) { for(node = connection_tree->head; node; node = node->next) { c = node->data; if(evbuffer_add_printf(out, - _(" %s at %s options %lx socket %d status %04x\n"), - c->name, c->hostname, c->options, c->socket, - c->status.value) == -1) + _(" %s at %s options %lx socket %d status %04x\n"), + c->name, c->hostname, c->options, c->socket, + bitfield_to_int(&c->status, sizeof c->status)) == -1) return errno; } @@ -125,7 +128,7 @@ bool read_connection_config(connection_t *c) { cp(); - asprintf(&fname, "%s/hosts/%s", confbase, c->name); + xasprintf(&fname, "%s/hosts/%s", confbase, c->name); x = read_config_file(c->config_tree, fname); free(fname);