Use a global list to track outgoing connections.

Previously an outgoing_t was maintained for each outgoing connection,
but the pointer to it was either stored in a connection_t or in an event_t.
This made it very hard to keep track of and to clean up.

Now a list is created when tinc starts and reads all the ConnectTo variables,
and which is recreated when tinc receives a HUP signal.
This commit is contained in:
Guus Sliepen 2009-01-20 13:12:41 +01:00
parent a7e793c94e
commit 503c32eb0e
6 changed files with 36 additions and 24 deletions

View file

@ -457,14 +457,6 @@ int main_loop(void)
for(node = connection_tree->head; node; node = node->next) {
c = node->data;
if(c->outgoing) {
free(c->outgoing->name);
if(c->outgoing->ai)
freeaddrinfo(c->outgoing->ai);
free(c->outgoing);
c->outgoing = NULL;
}
asprintf(&fname, "%s/hosts/%s", confbase, c->name);
if(stat(fname, &s) || s.st_mtime > last_config_check)
terminate_connection(c, c->status.active);