X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fconnlist.c;h=ac6970b5825fe00e7e382a4a4ef87c6e3d490e4b;hp=ebb276e757d96c7be2aa73fbb17409ac9900e735;hb=a26d371d0df3bee1bdc6e9d7046e949ee29e6de7;hpb=d47d5932a3bbc4940aa6453ebfe617ef330783c8 diff --git a/src/connlist.c b/src/connlist.c index ebb276e7..ac6970b5 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.11 2000/10/29 02:07:39 guus Exp $ */ #include @@ -27,6 +27,7 @@ #include "conf.h" #include +#include "xalloc.h" #include "system.h" /* Root of the connection list */ @@ -63,6 +64,8 @@ cp free(p->cipher_pktkey); if(p->buffer) free(p->buffer); + if(p->config) + clear_config(&p->config); free(p); cp } @@ -79,14 +82,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 +116,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 +132,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 +170,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); } }