Added statistics updating and statisics dumping with SIGUSR1.
[silc.git] / apps / silcd / command.c
index 6efee9d02707634c254677a072275c7db0a653ff..168f7bb3e8c7f85bb3637090bcead14592fe9de4 100644 (file)
@@ -3420,6 +3420,13 @@ static void silc_server_command_join_channel(SilcServer server,
                                     clidp->data, clidp->len,
                                     chidp->data, chidp->len);
 
+  /* Update statistics */
+  server->stat.my_chanclients++;
+  if (server->server_type == SILC_ROUTER) {
+    server->stat.cell_chanclients++;
+    server->stat.chanclients++;
+  }
+
   if (!cmd->pending) {
     /* Send JOIN notify packet to our primary router */
     if (!server->standalone)
@@ -3859,6 +3866,22 @@ SILC_SERVER_CMD_FUNC(umode)
       }
     }
 
+    /* Update statistics */
+    if (mask & 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;