From 5a7ba5406a8c7ddf5b06e001427a981790eefb50 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 18 Jun 2002 08:43:31 +0000 Subject: [PATCH] Statistics updating fixes to not go negative. --- apps/silcd/command.c | 10 ++-------- apps/silcd/packet_receive.c | 5 +++-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/silcd/command.c b/apps/silcd/command.c index 9760e1b5..ff46244a 100644 --- a/apps/silcd/command.c +++ b/apps/silcd/command.c @@ -3868,19 +3868,12 @@ SILC_SERVER_CMD_FUNC(umode) /* Update statistics */ if (mask & SILC_UMODE_GONE) { - if (!client->mode & SILC_UMODE_GONE) + if (!(client->mode & SILC_UMODE_GONE)) server->stat.my_aways++; } else { if (client->mode & SILC_UMODE_GONE) server->stat.my_aways--; } - if (mask & SILC_UMODE_DETACHED) { - if (!client->mode & SILC_UMODE_DETACHED) - server->stat.my_detached++; - } else { - if (client->mode & SILC_UMODE_DETACHED) - server->stat.my_detached--; - } /* Change the mode */ client->mode = mask; @@ -4982,6 +4975,7 @@ SILC_SERVER_CMD_FUNC(detach) silc_server_send_notify_umode(server, server->router->connection, server->server_type == SILC_SERVER ? FALSE : TRUE, client->id, client->mode); + server->stat.my_detached++; /* Check if anyone is watching this nickname */ if (server->server_type == SILC_ROUTER) diff --git a/apps/silcd/packet_receive.c b/apps/silcd/packet_receive.c index a2a756a0..bd9545f8 100644 --- a/apps/silcd/packet_receive.c +++ b/apps/silcd/packet_receive.c @@ -1442,14 +1442,14 @@ void silc_server_notify(SilcServer server, /* Update statistics */ if (server->server_type == SILC_ROUTER) { if (mode & SILC_UMODE_GONE) { - if (!client->mode & SILC_UMODE_GONE) + if (!(client->mode & SILC_UMODE_GONE)) server->stat.aways++; } else { if (client->mode & SILC_UMODE_GONE) server->stat.aways--; } if (mode & SILC_UMODE_DETACHED) { - if (!client->mode & SILC_UMODE_DETACHED) + if (!(client->mode & SILC_UMODE_DETACHED)) server->stat.detached++; } else { if (client->mode & SILC_UMODE_DETACHED) @@ -3369,6 +3369,7 @@ void silc_server_resume_client(SilcServer server, detached_client->data.status |= SILC_IDLIST_STATUS_REGISTERED; detached_client->data.status |= SILC_IDLIST_STATUS_RESUMED; detached_client->mode &= ~SILC_UMODE_DETACHED; + server->stat.my_detached--; /* Send the RESUME_CLIENT packet to our primary router so that others know this client isn't detached anymore. */ -- 2.24.0