From 429f85b77a203bb367a2e5ed2244e7c200db0295 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 23 Jan 2007 16:07:19 +0000 Subject: [PATCH] Remove Client_DestroyNow() to keep semantik "every CONNECTON has a CLIENT". --- src/ngircd/client.c | 35 +---------------------------------- src/ngircd/client.h | 5 +---- src/ngircd/conn.c | 12 ++---------- 3 files changed, 4 insertions(+), 48 deletions(-) diff --git a/src/ngircd/client.c b/src/ngircd/client.c index ce97c1ee..1e35fd81 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: client.c,v 1.94 2006/12/07 22:24:14 fw Exp $"; +static char UNUSED id[] = "$Id: client.c,v 1.95 2007/01/23 16:07:19 alex Exp $"; #include "imp.h" #include @@ -68,10 +68,6 @@ static CLIENT *Init_New_Client PARAMS((CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented)); -#ifndef Client_DestroyNow -GLOBAL void Client_DestroyNow PARAMS((CLIENT *Client )); -#endif - long Max_Users = 0, My_Max_Users = 0; @@ -336,35 +332,6 @@ Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit ) } /* Client_Destroy */ -GLOBAL void -Client_DestroyNow( CLIENT *Client ) -{ - /* Destroy client structure immediately. This function is only - * intended for the connection layer to remove client structures - * of connections that can't be established! */ - - CLIENT *last, *c; - - assert( Client != NULL ); - - last = NULL; - c = My_Clients; - while( c ) - { - if( c == Client ) - { - /* Wir haben den Client gefunden: entfernen */ - if( last ) last->next = c->next; - else My_Clients = (CLIENT *)c->next; - free( c ); - break; - } - last = c; - c = (CLIENT *)c->next; - } -} /* Client_DestroyNow */ - - GLOBAL void Client_SetHostname( CLIENT *Client, char *Hostname ) { diff --git a/src/ngircd/client.h b/src/ngircd/client.h index 0de36795..d211d23e 100644 --- a/src/ngircd/client.h +++ b/src/ngircd/client.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: client.h,v 1.45 2006/10/07 10:40:52 fw Exp $ + * $Id: client.h,v 1.46 2007/01/23 16:07:19 alex Exp $ * * Client management (header) */ @@ -80,9 +80,6 @@ GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, char *Hostnam GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented )); GLOBAL void Client_Destroy PARAMS(( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )); -#ifdef CONN_MODULE -GLOBAL void Client_DestroyNow PARAMS(( CLIENT *Client )); -#endif GLOBAL CLIENT *Client_ThisServer PARAMS(( void )); diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 60128eae..4a55bd2a 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -17,7 +17,7 @@ #include "portab.h" #include "io.h" -static char UNUSED id[] = "$Id: conn.c,v 1.201 2006/12/25 01:11:12 fw Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.202 2007/01/23 16:07:19 alex Exp $"; #include "imp.h" #include @@ -123,7 +123,6 @@ cb_connserver(int sock, UNUSED short what) { int res, err; socklen_t sock_len; - CLIENT *c; CONN_ID idx = Socket2Index( sock ); if (idx <= NONE) { LogDebug("cb_connserver wants to write on unknown socket?!"); @@ -150,14 +149,7 @@ cb_connserver(int sock, UNUSED short what) Conf_Server[Conf_GetServer(idx)].port, idx, strerror(err)); - /* Clean up the CLIENT structure (to avoid silly log - * messages) and call Conn_Close() to do the rest. */ - c = Conn_GetClient(idx); - if (c) - Client_DestroyNow(c); - - Conn_Close(idx, "Can't connect!", NULL, false); - + Conn_Close(idx, "Can't connect!", NULL, false); return; } -- 2.39.2