+ avl_node_t *node;
+ connection_t *other;
+cp
+ if(c->status.remove)
+ return;
+
+ if(debug_lvl >= DEBUG_CONNECTIONS)
+ syslog(LOG_NOTICE, _("Closing connection with %s (%s)"),
+ c->name, c->hostname);
+
+ c->status.remove = 1;
+
+ if(c->socket)
+ close(c->socket);
+
+ if(c->edge)
+ {
+ if(report)
+ {
+ for(node = connection_tree->head; node; node = node->next)
+ {
+ other = (connection_t *)node->data;
+ if(other->status.active && other != c)
+ send_del_edge(other, c->edge);
+ }
+ }
+
+ edge_del(c->edge);
+ }
+
+ /* Check if this was our outgoing connection */
+
+ if(c->status.outgoing)
+ {
+ c->status.outgoing = 0;
+ signal(SIGALRM, try_outgoing_connections);
+ alarm(seconds_till_retry);
+ syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in %d seconds"), seconds_till_retry);
+ }
+
+ /* Deactivate */
+
+ c->status.active = 0;
+ if(c->node)
+ c->node->connection = NULL;
+ do_prune = 1;
+cp