From 4efcdfe090d4e6e59cdb876d27ddc796f6fd4c6f Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 25 Nov 2012 02:59:48 +0000 Subject: [PATCH] - More refactoring related to local[] removal. --- src/ircd.c | 11 ++--------- src/s_bsd.c | 52 ++++++++++++++++++++++++++++++--------------------- src/s_debug.c | 7 ------- 3 files changed, 33 insertions(+), 37 deletions(-) diff --git a/src/ircd.c b/src/ircd.c index b4d33b190..788dfc65e 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -1713,10 +1713,7 @@ static void open_debugfile(void) SetLog(cptr); cptr->port = debuglevel; cptr->flags = 0; - cptr->listener = cptr; - /* - * local[2] = cptr; winlocal - */ + (void)strlcpy(cptr->sockhost, me.sockhost, sizeof cptr->sockhost); # ifndef _WIN32 @@ -1740,12 +1737,8 @@ static void open_debugfile(void) Debug((DEBUG_FATAL, "Debug: File <%s> Level: %d at %s", cptr->name, cptr->port, myctime(time(NULL)))); - } else - /* - * local[2] = NULL; winlocal - */ + } #endif - return; } static void setup_signals() diff --git a/src/s_bsd.c b/src/s_bsd.c index 4ad086bab..e38a80c7d 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -175,28 +175,39 @@ void remove_local_client(aClient* cptr) void close_connections(void) { - aClient* cptr; - int i = LastSlot; + aClient* cptr; + + list_for_each_entry(cptr, &lclient_list, lclient_node) + { + if (cptr->fd >= 0) + { + fd_close(cptr->fd); + cptr->fd = -2; + } + } + + list_for_each_entry(cptr, &unknown_list, lclient_node) + { + if (cptr->fd >= 0) + { + fd_close(cptr->fd); + cptr->fd = -2; + } + + if (cptr->authfd >= 0) + { + fd_close(cptr->authfd); + cptr->fd = -1; + } + } + + close_listeners(); + + OpenFiles = 0; + LastSlot = -1; - for ( ; i >= 0; --i) - { - if ((cptr = local[i]) != 0) - { - if (cptr->fd >= 0) { - fd_close(cptr->fd); - cptr->fd = -2; - } - if (cptr->authfd >= 0) - { - fd_close(cptr->authfd); - cptr->authfd = -1; - } - } - } - OpenFiles = 0; - LastSlot = -1; #ifdef _WIN32 - WSACleanup(); + WSACleanup(); #endif } @@ -642,7 +653,6 @@ if ((bootopt & BOOT_CONSOLE) || isatty(0)) #ifndef NOCLOSEFD (void)close(0); /* fd 0 opened by inetd */ #endif - local[0] = NULL; } init_dgram: #else diff --git a/src/s_debug.c b/src/s_debug.c index f9095cb2a..9a57533fb 100644 --- a/src/s_debug.c +++ b/src/s_debug.c @@ -214,13 +214,6 @@ void debug(int level, char *form, ...) #endif #endif -#if 0 - if (local[2]) - { - local[2]->sendM++; - local[2]->sendB += strlen(debugbuf); - } -#endif #ifndef _WIN32 (void)fprintf(stderr, "%s", debugbuf); (void)fputc('\n', stderr);