From: Remco Rijnders Date: Sat, 7 Mar 2026 17:17:36 +0000 (-0500) Subject: CLEANUP: Remove DOMAINNAME-based local client tracking X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=a750687da66d7df4e381246af3642b64583b1d98;p=serene-ircd.git CLEANUP: Remove DOMAINNAME-based local client tracking The ircd tracked "local clients" by matching connected users' sockhost against *DOMAINNAME, a relic from when IRC servers ran at universities and tracking same-host users was meaningful. This is no longer a relevant metric. Removes: - lu_lulocal variable and all DOMAINNAME mask matching in check_lusers(), m_lusers(), and exit_one_client() - local_count field from current_load_struct and load_entry - DOMAINNAME define from config.h and setup.h - The "DOMAINNAME clients" row from userload stats output Keeps: - lu_lu / m_client (MyConnect clients = clients connected to this server) which is the standard IRC "local users" for LUSERS - All global user counters and max tracking Co-Authored-By: Claude Opus 4.6 --- diff --git a/include/common.h b/include/common.h index 4aba493..d43fc0f 100644 --- a/include/common.h +++ b/include/common.h @@ -127,8 +127,8 @@ extern int mode_snick() ; extern char *malloc_options; #endif -extern int lu_noninv, lu_inv, lu_serv, lu_oper, - lu_unknown, lu_channel, lu_lu, lu_lulocal, lu_lserv, +extern int lu_noninv, lu_inv, lu_serv, lu_oper, + lu_unknown, lu_channel, lu_lu, lu_lserv, lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu; diff --git a/include/config.h b/include/config.h index 4b19c53..0b88caa 100644 --- a/include/config.h +++ b/include/config.h @@ -128,15 +128,6 @@ */ #define USERSTATMAX 120 -/* - * NOTE: It is important to set this to the correct "domain" for your server. - * Define this for the correct "domain" that your server is in. This - * is important for certain stats. -mlv - */ -#ifndef DOMAINNAME -#define DOMAINNAME "serenity-irc.net" -#endif - /* * Define this if you wish to output a *file* to a K lined client rather * than the K line comment (the comment field is treated as a filename) diff --git a/include/setup.h b/include/setup.h index 3867d50..88813d4 100644 --- a/include/setup.h +++ b/include/setup.h @@ -29,5 +29,4 @@ #define CONTACT_URL "http://www.serenity-irc.net/connect.html" #define SERVICES_NAME "Services.Serenity-IRC.Net" #define KLINE_ADDRESS "remmy@serenity-irc.net" -#define DOMAINNAME "glenmoor" #define ZIP_LINKS 1 diff --git a/include/userload.h b/include/userload.h index 127c32d..ab91819 100644 --- a/include/userload.h +++ b/include/userload.h @@ -28,7 +28,7 @@ #endif struct current_load_struct { - u_short client_count, local_count, conn_count; + u_short client_count, conn_count; u_long entries; }; @@ -36,7 +36,7 @@ extern struct current_load_struct current_load_data; struct load_entry { struct load_entry *prev; - u_short client_count, local_count, conn_count; + u_short client_count, conn_count; #ifdef DEBUGMODE u_short cpu_usage; #endif diff --git a/src/ircd.c b/src/ircd.c index bf61686..fc9dbf9 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -77,7 +77,7 @@ time_t lastlucheck = 0; time_t lastbwcheck = 0; /* next time to do the bandwidtch check */ int lu_noninv, lu_inv, lu_serv, lu_oper, lu_unknown, lu_channel, lu_lu, - lu_lulocal, lu_lserv, lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu; + lu_lserv, lu_clu, lu_mlu, lu_cglobalu, lu_mglobalu; int is_hub = 0; @@ -841,8 +841,6 @@ static void setup_signals () } -#define DOMAINNAMEMASK "*" DOMAINNAME - void check_lusers (void) { aClient *acptr; @@ -859,11 +857,8 @@ void check_lusers (void) case STAT_CLIENT: if (IsOper (acptr)) lu_oper++; - if (MyConnect (acptr)) { + if (MyConnect (acptr)) lu_lu++; - if (match (DOMAINNAMEMASK, acptr->sockhost) == 0) - lu_lulocal++; - } if (!IsInvisible (acptr)) lu_noninv++; else @@ -878,7 +873,6 @@ void check_lusers (void) lu_cglobalu = lu_noninv + lu_inv; if (lu_clu > lu_mlu) lu_mlu = lu_lu; - lu_cglobalu = lu_noninv + lu_inv; if (lu_cglobalu > lu_mglobalu) lu_mglobalu = lu_cglobalu; diff --git a/src/s_misc.c b/src/s_misc.c index 240afce..28f01ac 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -364,12 +364,7 @@ int exit_client (cptr, sptr, from, comment) comment); current_load_data.conn_count--; if (IsPerson (sptr)) { - char mydom_mask[HOSTLEN + 1]; - mydom_mask[0] = '*'; - strncpy (&mydom_mask[1], DOMAINNAME, HOSTLEN - 1); current_load_data.client_count--; - if (match (mydom_mask, sptr->sockhost) == 0) - current_load_data.local_count--; /* Clean out list and watch structures -Donwulff */ hash_del_notify_list (sptr); if (sptr->lopt) { diff --git a/src/s_serv.c b/src/s_serv.c index 2f319da..ada7ac6 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -1727,22 +1727,14 @@ int m_help (aClient *cptr, aClient *sptr, int parc, char *parv[]) int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int s_count, c_count, u_count, i_count; - int o_count, m_client, m_client_local, m_server; - char mydom_mask[HOSTLEN + 1]; + int o_count, m_client, m_server; aClient *acptr; -/* Not needed re change to parse.c - if (check_registered_user(sptr)) - return 0; - */ if (parc > 2) if (hunt_server (cptr, sptr, ":%s LUSERS %s :%s", 2, parc, parv) != HUNTED_ISME) return 0; - mydom_mask[0] = '*'; - strncpy (&mydom_mask[1], DOMAINNAME, HOSTLEN - 1); - if (parc == 1) { s_count = lu_serv; c_count = lu_noninv; @@ -1750,13 +1742,12 @@ int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[]) i_count = lu_inv; o_count = lu_oper; m_client = lu_lu; - m_client_local = lu_lulocal; m_server = lu_lserv; global_count = lu_cglobalu; } else { s_count = c_count = u_count = i_count = o_count = m_client = - m_client_local = m_server = 0; + m_server = 0; (void) collapse (parv[1]); for (acptr = client; acptr; acptr = acptr->next) { if (parc > 1) { @@ -1779,11 +1770,8 @@ int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[]) case STAT_CLIENT: if (IsOper (acptr)) o_count++; - if (MyConnect (acptr)) { + if (MyConnect (acptr)) m_client++; - if (match (mydom_mask, acptr->sockhost) == 0) - m_client_local++; - } if (!IsInvisible (acptr)) c_count++; else @@ -1822,7 +1810,6 @@ int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[]) sendto_ops ("Maximum connections: %d (%d clients)", max_connection_count, max_client_count); } - current_load_data.local_count = m_client_local; current_load_data.client_count = m_client; current_load_data.conn_count = m_client + m_server; return 0; diff --git a/src/userload.c b/src/userload.c index d20e7e3..7eae37f 100644 --- a/src/userload.c +++ b/src/userload.c @@ -51,8 +51,7 @@ void update_load () /* This seems to get polluted on startup by an exit_client() * before any connections have been recorded. */ - if (current_load_data.local_count > MAXCONNECTIONS || - current_load_data.client_count > MAXCONNECTIONS || + if (current_load_data.client_count > MAXCONNECTIONS || current_load_data.conn_count > MAXCONNECTIONS) memset (¤t_load_data, 0, sizeof (struct current_load_struct)); @@ -81,7 +80,6 @@ void update_load () ((now.tv_sec * 1000 + now.tv_usec / 1000 + 5) - (last.tv_sec * 1000 + last.tv_usec / 1000)) / 10; - cur_load_entry->local_count = current_load_data.local_count; cur_load_entry->client_count = current_load_data.client_count; cur_load_entry->conn_count = current_load_data.conn_count; #ifdef DEBUGMODE @@ -104,18 +102,18 @@ void calc_load (aClient *sptr, char *parv) struct load_entry *cur_load_entry; struct load_entry *last = NULL; #ifdef DEBUGMODE - u_long secs = 0, adj_secs, total[4], adj[4]; /*[local,client,conn,cpu] */ + u_long secs = 0, adj_secs, total[3], adj[3]; /*[client,conn,cpu] */ int i; - u_int times[5][4]; /* [min,hour,day,Yest,YYest][local,client,conn,cpu] */ - char what[4][HOSTLEN + 1]; - - memset (total, 0, 4 * sizeof (u_long)); -#else - u_long secs = 0, adj_secs, total[3], adj[3]; /*[local,client,conn] */ - int i, times[5][3]; /* [min,hour,day,Yest,YYest][local,client,conn] */ + u_int times[5][3]; /* [min,hour,day,Yest,YYest][client,conn,cpu] */ char what[3][HOSTLEN + 1]; memset (total, 0, 3 * sizeof (u_long)); +#else + u_long secs = 0, adj_secs, total[2], adj[2]; /*[client,conn] */ + int i, times[5][2]; /* [min,hour,day,Yest,YYest][client,conn] */ + char what[2][HOSTLEN + 1]; + + memset (total, 0, 2 * sizeof (u_long)); #endif current_load_data.entries = 0; @@ -125,11 +123,10 @@ void calc_load (aClient *sptr, char *parv) for (cur_load_entry = load_list_tail; (secs < 6000) && (cur_load_entry != NULL); cur_load_entry = cur_load_entry->prev) { u_long time_incr = cur_load_entry->time_incr; - total[0] += time_incr * cur_load_entry->local_count; - total[1] += time_incr * cur_load_entry->client_count; - total[2] += time_incr * cur_load_entry->conn_count; + total[0] += time_incr * cur_load_entry->client_count; + total[1] += time_incr * cur_load_entry->conn_count; #ifdef DEBUGMODE - total[3] += cur_load_entry->cpu_usage; + total[2] += cur_load_entry->cpu_usage; #endif last = cur_load_entry; secs += cur_load_entry->time_incr; @@ -137,186 +134,177 @@ void calc_load (aClient *sptr, char *parv) } if ((secs > 6000) && (last != NULL)) { adj_secs = secs - 6000; - adj[0] = adj_secs * last->local_count; - adj[1] = adj_secs * last->client_count; - adj[2] = adj_secs * last->conn_count; + adj[0] = adj_secs * last->client_count; + adj[1] = adj_secs * last->conn_count; #ifdef DEBUGMODE - times[0][3] = - total[3] - + times[0][2] = + total[2] - (last->cpu_usage * (double) adj_secs / last->time_incr); } else { - adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0; - times[0][3] = total[3]; + adj_secs = adj[0] = adj[1] = adj[2] = 0; + times[0][2] = total[2]; } #else } else - adj_secs = adj[0] = adj[1] = adj[2] = 0; + adj_secs = adj[0] = adj[1] = 0; #endif - for (i = 0; i < 3; i++) { + for (i = 0; i < 2; i++) { times[0][i] = ((total[i] - adj[i]) * 1000 / (secs - adj_secs) + 5) / 10; } secs = (secs + 5) / 10; - for (i = 0; i < 3; i++) + for (i = 0; i < 2; i++) total[i] = (total[i] + 5) / 10; for (; (secs < 36000) && (cur_load_entry != NULL); secs += (cur_load_entry->time_incr + 5) / 10, cur_load_entry = cur_load_entry->prev, current_load_data.entries++) { u_long time_incr = (cur_load_entry->time_incr + 5) / 10; - total[0] += time_incr * cur_load_entry->local_count; - total[1] += time_incr * cur_load_entry->client_count; - total[2] += time_incr * cur_load_entry->conn_count; + total[0] += time_incr * cur_load_entry->client_count; + total[1] += time_incr * cur_load_entry->conn_count; #ifdef DEBUGMODE - total[3] += cur_load_entry->cpu_usage; + total[2] += cur_load_entry->cpu_usage; #endif last = cur_load_entry; } if ((secs > 36000) && (last != NULL)) { adj_secs = secs - 36000; - adj[0] = adj_secs * last->local_count; - adj[1] = adj_secs * last->client_count; - adj[2] = adj_secs * last->conn_count; + adj[0] = adj_secs * last->client_count; + adj[1] = adj_secs * last->conn_count; #ifdef DEBUGMODE - times[1][3] = - total[3] - + times[1][2] = + total[2] - (last->cpu_usage * (double) adj_secs / last->time_incr); } else { - adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0; - times[1][3] = total[3]; + adj_secs = adj[0] = adj[1] = adj[2] = 0; + times[1][2] = total[2]; } #else } else - adj_secs = adj[0] = adj[1] = adj[2] = 0; + adj_secs = adj[0] = adj[1] = 0; #endif - for (i = 0; i < 3; i++) { + for (i = 0; i < 2; i++) { times[1][i] = ((total[i] - adj[i]) * 100 / (secs - adj_secs) + 5) / 10; } secs = (secs + 5) / 10; - for (i = 0; i < 3; i++) + for (i = 0; i < 2; i++) total[i] = (total[i] + 5) / 10; for (; (secs < 86400) && (cur_load_entry != NULL); secs += (cur_load_entry->time_incr + 50) / 100, cur_load_entry = cur_load_entry->prev, current_load_data.entries++) { u_long time_incr = (cur_load_entry->time_incr + 50) / 100; - total[0] += time_incr * cur_load_entry->local_count; - total[1] += time_incr * cur_load_entry->client_count; - total[2] += time_incr * cur_load_entry->conn_count; + total[0] += time_incr * cur_load_entry->client_count; + total[1] += time_incr * cur_load_entry->conn_count; #ifdef DEBUGMODE - total[3] += cur_load_entry->cpu_usage; + total[2] += cur_load_entry->cpu_usage; #endif last = cur_load_entry; } if ((secs > 86400) && (last != NULL)) { adj_secs = secs - 86400; - adj[0] = adj_secs * last->local_count; - adj[1] = adj_secs * last->client_count; - adj[2] = adj_secs * last->conn_count; + adj[0] = adj_secs * last->client_count; + adj[1] = adj_secs * last->conn_count; #ifdef DEBUGMODE - times[2][3] = - total[3] - + times[2][2] = + total[2] - (last->cpu_usage * (double) adj_secs / last->time_incr); } else { - adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0; - times[2][3] = total[3]; + adj_secs = adj[0] = adj[1] = adj[2] = 0; + times[2][2] = total[2]; } #else } else - adj_secs = adj[0] = adj[1] = adj[2] = 0; + adj_secs = adj[0] = adj[1] = 0; #endif - for (i = 0; i < 3; i++) { + for (i = 0; i < 2; i++) { times[2][i] = ((total[i] - adj[i]) * 10 / (secs - adj_secs) + 5) / 10; } #ifdef DEBUGMODE - memset (total, 0, 4 * sizeof (u_long)); -#else memset (total, 0, 3 * sizeof (u_long)); +#else + memset (total, 0, 2 * sizeof (u_long)); #endif for (secs = 1; (secs < 86400) && (cur_load_entry != NULL); secs += (cur_load_entry->time_incr + 50) / 100, cur_load_entry = cur_load_entry->prev, current_load_data.entries++) { u_long time_incr = (cur_load_entry->time_incr + 50) / 100; - total[0] += time_incr * cur_load_entry->local_count; - total[1] += time_incr * cur_load_entry->client_count; - total[2] += time_incr * cur_load_entry->conn_count; + total[0] += time_incr * cur_load_entry->client_count; + total[1] += time_incr * cur_load_entry->conn_count; #ifdef DEBUGMODE - total[3] += cur_load_entry->cpu_usage; + total[2] += cur_load_entry->cpu_usage; #endif last = cur_load_entry; } if ((secs > 86400) && (last != NULL)) { adj_secs = secs - 86400; - adj[0] = adj_secs * last->local_count; - adj[1] = adj_secs * last->client_count; - adj[2] = adj_secs * last->conn_count; + adj[0] = adj_secs * last->client_count; + adj[1] = adj_secs * last->conn_count; #ifdef DEBUGMODE - times[3][3] = - total[3] - + times[3][2] = + total[2] - (last->cpu_usage * (double) adj_secs / last->time_incr); } else { - adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0; - times[3][3] = total[3]; + adj_secs = adj[0] = adj[1] = adj[2] = 0; + times[3][2] = total[2]; } #else } else - adj_secs = adj[0] = adj[1] = adj[2] = 0; + adj_secs = adj[0] = adj[1] = 0; #endif - for (i = 0; i < 3; i++) { + for (i = 0; i < 2; i++) { times[3][i] = ((total[i] - adj[i]) * 10 / (secs - adj_secs) + 5) / 10; } #ifdef DEBUGMODE - memset (total, 0, 4 * sizeof (u_long)); -#else memset (total, 0, 3 * sizeof (u_long)); +#else + memset (total, 0, 2 * sizeof (u_long)); #endif for (secs = 1; (secs < 86400) && (cur_load_entry != NULL); secs += (cur_load_entry->time_incr + 50) / 100, cur_load_entry = cur_load_entry->prev, current_load_data.entries++) { u_long time_incr = (cur_load_entry->time_incr + 50) / 100; - total[0] += time_incr * cur_load_entry->local_count; - total[1] += time_incr * cur_load_entry->client_count; - total[2] += time_incr * cur_load_entry->conn_count; + total[0] += time_incr * cur_load_entry->client_count; + total[1] += time_incr * cur_load_entry->conn_count; #ifdef DEBUGMODE - total[3] += cur_load_entry->cpu_usage; + total[2] += cur_load_entry->cpu_usage; #endif last = cur_load_entry; } if ((secs > 86400) && (last != NULL)) { adj_secs = secs - 86400; - adj[0] = adj_secs * last->local_count; - adj[1] = adj_secs * last->client_count; - adj[2] = adj_secs * last->conn_count; + adj[0] = adj_secs * last->client_count; + adj[1] = adj_secs * last->conn_count; #ifdef DEBUGMODE - times[4][3] = - total[3] - + times[4][2] = + total[2] - (last->cpu_usage * (double) adj_secs / last->time_incr); } else { - adj_secs = adj[0] = adj[1] = adj[2] = adj[3] = 0; - times[4][3] = total[3]; + adj_secs = adj[0] = adj[1] = adj[2] = 0; + times[4][2] = total[2]; } #else } else - adj_secs = adj[0] = adj[1] = adj[2] = 0; + adj_secs = adj[0] = adj[1] = 0; #endif - for (i = 0; i < 3; i++) { + for (i = 0; i < 2; i++) { times[4][i] = ((total[i] - adj[i]) * 10 / (secs - adj_secs) + 5) / 10; } @@ -335,17 +323,15 @@ void calc_load (aClient *sptr, char *parv) cur_load_entry->prev = NULL; } - strcpy (what[0], DOMAINNAME); - strcat (what[0], " clients"); - strcpy (what[1], "total clients"); - strcpy (what[2], "total connections"); + strcpy (what[0], "total clients"); + strcpy (what[1], "total connections"); #ifdef DEBUGMODE - strcpy (what[3], "CPU usage"); + strcpy (what[2], "CPU usage"); #endif sendto_one (sptr, ":%s NOTICE %s :Minute Hour Day Yest. YYest. Userload for:", me.name, parv); - for (i = 0; i < 3; i++) + for (i = 0; i < 2; i++) sendto_one (sptr, ":%s NOTICE %s :%3d.%02d %3d.%01d %3d %3d %3d %s", me.name, parv, times[0][i] / 100, times[0][i] % 100, @@ -356,12 +342,12 @@ void calc_load (aClient *sptr, char *parv) sendto_one (sptr, ":%s NOTICE %s :%6.2f%% %5.1f%% %3d%% %3d%% %3d%% %s", me.name, parv, - (double) ((double) times[0][3] / (0.6 * CLOCKS_PER_SEC)), - (double) ((double) times[1][3] / (36 * CLOCKS_PER_SEC)), - (int) ((double) times[2][3] / (864 * CLOCKS_PER_SEC)), - (int) ((double) times[3][3] / (864 * CLOCKS_PER_SEC)), - (int) ((double) times[4][3] / (864 * CLOCKS_PER_SEC)), - what[3]); + (double) ((double) times[0][2] / (0.6 * CLOCKS_PER_SEC)), + (double) ((double) times[1][2] / (36 * CLOCKS_PER_SEC)), + (int) ((double) times[2][2] / (864 * CLOCKS_PER_SEC)), + (int) ((double) times[3][2] / (864 * CLOCKS_PER_SEC)), + (int) ((double) times[4][2] / (864 * CLOCKS_PER_SEC)), + what[2]); #endif }