X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=28a0341e0a28e1485c077393671b51702b1e6141;hb=a5984c702ae3d141d0fff70b0b634b47dade72c3;hp=4d778719a2c8623c60570e9c839877595b38e0a2;hpb=695df6532ec717e5571e1ddc2c88a8c968603c5a;p=ngircd-alex.git diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 4d778719..28a0341e 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * 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 @@ -1839,10 +1839,10 @@ Check_Connections(void) if (My_Connections[i].lastping < time(NULL) - Conf_PongTimeout) { /* Timeout */ - LogDebug - ("Connection %d: Ping timeout: %d seconds.", - i, Conf_PongTimeout); - snprintf(msg, sizeof(msg), "Ping timeout: %d seconds", Conf_PongTimeout); + snprintf(msg, sizeof(msg), + "Ping timeout: %d seconds", + Conf_PongTimeout); + LogDebug("Connection %d: %s.", i, msg); Conn_Close(i, NULL, msg, true); } } else if (My_Connections[i].lastdata < @@ -1935,6 +1935,14 @@ New_Server( int Server , ng_ipaddr_t *dest) assert( Server > NONE ); + /* Make sure that the remote server hasn't re-linked to this server + * asynchronously on its own */ + if (Conf_Server[Server].conn_id > NONE) { + Log(LOG_INFO, + "Connection to \"%s\" meanwhile re-established, aborting preparation."); + return; + } + if (!ng_ipaddr_tostr_r(dest, ip_str)) { Log(LOG_WARNING, "New_Server: Could not convert IP to string"); return; @@ -2008,7 +2016,7 @@ New_Server( int Server , ng_ipaddr_t *dest) Client_SetToken( c, TOKEN_OUTBOUND ); /* Register connection */ - Conf_Server[Server].conn_id = new_sock; + Conf_SetServer(Server, new_sock); My_Connections[new_sock].sock = new_sock; My_Connections[new_sock].addr = *dest; My_Connections[new_sock].client = c; @@ -2249,7 +2257,7 @@ cb_Read_Resolver_Result( int r_fd, UNUSED short events ) if (Conf_NoticeAuth) { (void)Conn_WriteStr(i, "NOTICE AUTH :*** Got %sident response", - *ptr == NULL ? "" : "invalid "); + *ptr ? "invalid " : ""); } } else { Log(LOG_INFO, "IDENT lookup for connection %d: no result.", i);