X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fconnlist.c;h=2965ced20a726180277eef5a2cb4030e1c17a9a5;hp=ebb276e757d96c7be2aa73fbb17409ac9900e735;hb=35932fe6c8cb481eb687f98424776ce429570c21;hpb=db21f015161aac244ec5600c4d0ff685549892c2 diff --git a/src/connlist.c b/src/connlist.c index ebb276e7..2965ced2 100644 --- a/src/connlist.c +++ b/src/connlist.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: connlist.c,v 1.1.2.9 2000/10/28 16:41:37 guus Exp $ + $Id: connlist.c,v 1.1.2.10 2000/10/29 00:02:17 guus Exp $ */ #include @@ -27,6 +27,7 @@ #include "conf.h" #include +#include "xalloc.h" #include "system.h" /* Root of the connection list */ @@ -79,14 +80,7 @@ cp next = p->next; if(p->status.remove) - { - if(prev) - prev->next = next; - else - conn_list = next; - - free_conn_list(p); - } + conn_list_del(p); else prev = p; @@ -120,8 +114,10 @@ void conn_list_add(conn_list_t *cl) cp cl->next = conn_list; cl->prev = NULL; + if(cl->next) cl->next->prev = cl; + conn_list = cl; cp } @@ -134,7 +130,9 @@ cp else conn_list = cl->next; - cl->next->prev = cl->prev; + if(cl->next) + cl->next->prev = cl->prev; + free_conn_list(cl); cp } @@ -170,20 +168,20 @@ cp for(s = myself->subnets; s != NULL; s = s->next) { netstr = net2str(s); - syslog(LOG_DEBUG, ": %s", netstr); + syslog(LOG_DEBUG, " %s", netstr); free(netstr); } for(p = conn_list; p != NULL; p = p->next) { - syslog(LOG_DEBUG, _("%s at %s port %hd flags %d sockets %d, %d status %04x"), + syslog(LOG_DEBUG, _(" %s at %s port %hd flags %d sockets %d, %d status %04x"), p->name, p->hostname, p->port, p->flags, p->socket, p->meta_socket, p->status); for(s = p->subnets; s != NULL; s = s->next) { netstr = net2str(s); - syslog(LOG_DEBUG, ": %s", netstr); + syslog(LOG_DEBUG, " %s", netstr); free(netstr); } }