X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fmeta.c;h=7a68d9d2c072d18ec33c26be3c31eaca7ca445f8;hp=e108ea1a8a9f8a63a65ef564a41445aed4ffcb35;hb=5fc1ed17f41f0c535cf57a4b7e00cd6d45759503;hpb=f64b41a73b3b432aae17ba990414e0be2f61ce62 diff --git a/src/meta.c b/src/meta.c index e108ea1a..7a68d9d2 100644 --- a/src/meta.c +++ b/src/meta.c @@ -1,7 +1,7 @@ /* meta.c -- handle the meta communication - Copyright (C) 2000-2002 Guus Sliepen , - 2000-2002 Ivo Timmermans + Copyright (C) 2000-2002 Guus Sliepen , + 2000-2002 Ivo Timmermans This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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: meta.c,v 1.1.2.23 2002/02/12 14:36:45 guus Exp $ + $Id: meta.c,v 1.1.2.28 2002/09/09 19:39:58 guus Exp $ */ #include "config.h" @@ -44,7 +44,7 @@ int send_meta(connection_t *c, char *buffer, int length) char *bufp; int outlen; char outbuf[MAXBUFSIZE]; -cp + cp(); if(debug_lvl >= DEBUG_META) syslog(LOG_DEBUG, _("Sending %d bytes of metadata to %s (%s)"), length, c->name, c->hostname); @@ -60,10 +60,10 @@ cp if(write(c->socket, bufp, length) < 0) { - syslog(LOG_ERR, _("Sending meta data to %s (%s) failed: %m"), c->name, c->hostname); + syslog(LOG_ERR, _("Sending meta data to %s (%s) failed: %s"), c->name, c->hostname, strerror(errno)); return -1; } -cp + cp(); return 0; } @@ -71,14 +71,14 @@ void broadcast_meta(connection_t *from, char *buffer, int length) { avl_node_t *node; connection_t *c; -cp + cp(); for(node = connection_tree->head; node; node = node->next) { c = (connection_t *)node->data; if(c != from && c->status.active) send_meta(c, buffer, length); } -cp + cp(); } int receive_meta(connection_t *c) @@ -88,10 +88,10 @@ int receive_meta(connection_t *c) int lenin, reqlen; int decrypted = 0; char inbuf[MAXBUFSIZE]; -cp + cp(); if(getsockopt(c->socket, SOL_SOCKET, SO_ERROR, &x, &l) < 0) { - syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%m %s (%s)"), __FILE__, __LINE__, c->socket, + syslog(LOG_ERR, _("This is a bug: %s:%d: %d:%s %s (%s)"), __FILE__, __LINE__, c->socket, strerror(errno), c->name, c->hostname); return -1; } @@ -125,8 +125,8 @@ cp if(errno==EINTR) return 0; else - syslog(LOG_ERR, _("Metadata socket read error for %s (%s): %m"), - c->name, c->hostname); + syslog(LOG_ERR, _("Metadata socket read error for %s (%s): %s"), + c->name, c->hostname, strerror(errno)); return -1; } @@ -182,6 +182,7 @@ cp if(reqlen) { + c->reqlen = reqlen; if(receive_request(c)) return -1; @@ -204,7 +205,7 @@ cp return -1; } - c->last_ping_time = time(NULL); -cp + c->last_ping_time = now; + cp(); return 0; }