- conn_list_t *p;
- subnet_t *s;
-cp
- if(cl->status.remove)
- {
- return;
- }
-
- cl->status.remove = 1;
-
- if(debug_lvl >= DEBUG_CONNECTIONS)
- syslog(LOG_NOTICE, _("Closing connection with %s (%s)"),
- cl->name, cl->hostname);
-
- if(cl->socket)
- close(cl->socket);
- if(cl->status.meta)
- close(cl->meta_socket);
-
-cp
- /* Find all connections that were lost because they were behind cl
- (the connection that was dropped). */
-
- if(cl->status.meta)
- for(p = conn_list; p != NULL; p = p->next)
- if((p->nexthop == cl) && (p != cl))
- terminate_connection(p); /* Sounds like recursion, but p does not have a meta connection :) */
-
- /* Inform others of termination if it was still active */
-
- if(cl->status.active)
- for(p = conn_list; p != NULL; p = p->next)
- if(p->status.meta && p->status.active && p!=cl)
- send_del_host(p, cl);
-
- /* Remove the associated subnets */
-
- for(s = cl->subnets; s; s = s->next)
- subnet_del(s);
-
- /* Inactivate */
-
- cl->status.active = 0;
-
- /* Check if this was our outgoing connection */
-
- if(cl->status.outgoing)
- {
- signal(SIGALRM, sigalrm_handler);
- seconds_till_retry = 5;
- alarm(seconds_till_retry);
- syslog(LOG_NOTICE, _("Trying to re-establish outgoing connection in 5 seconds"));
- }
-cp