silcd: increment stat.clients statistics whenever adding new client
authorPekka Riikonen <priikone@silcnet.org>
Sat, 17 Jan 2009 09:42:07 +0000 (11:42 +0200)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 17 Jan 2009 09:42:07 +0000 (11:42 +0200)
When new client is added to server the stat.clients must always be
incremented.  Otherwise it is possible to go under zero when removing
the clients by server.

apps/silcd/command_reply.c
apps/silcd/packet_receive.c
apps/silcd/server.c
apps/silcd/server_util.c
configure.ad
distdir/autodist.conf

index b54126cfcd7c48645ed73957f65a642ca61ad606..a31588d6e71d529ba4f54e0b5ee12b81fa36b2a5 100644 (file)
@@ -236,6 +236,10 @@ silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
     client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
     client->mode = mode;
     client->servername = servername[0] ? strdup(servername) : NULL;
+
+    SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+                   server->stat.clients + 1));
+    server->stat.clients++;
   } else {
     /* We have the client already, update the data */
 
@@ -660,6 +664,10 @@ silc_server_command_reply_identify_save(SilcServerCommandReplyContext cmd)
       client->data.status |= SILC_IDLIST_STATUS_REGISTERED;
       client->data.status |= SILC_IDLIST_STATUS_RESOLVED;
       client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
+
+      SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+                     server->stat.clients + 1));
+      server->stat.clients++;
     } else {
       /* We have the client already, update the data */
 
@@ -1242,7 +1250,7 @@ SILC_SERVER_CMD_REPLY_FUNC(stats)
                         SILC_STR_END);
   }
 
-  SILC_LOG_DEBUG(("stat.clients = %d\n", server->stat.clients));
+  SILC_LOG_DEBUG(("stat.clients = %d", server->stat.clients));
 
  out:
   SILC_SERVER_PENDING_EXEC(cmd, SILC_COMMAND_STATS);
index 0d96f7bbe6f026005ed9f4af246c70ea986ee17a..2d9ce41f874227a35d55f8248abfb8a5c5978066 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2009 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -186,6 +186,12 @@ static void silc_server_notify_process(SilcServer server,
        }
 
        client->data.status |= SILC_IDLIST_STATUS_REGISTERED;
+
+       if (idata->conn_type == SILC_CONN_SERVER)
+         server->stat.cell_clients++;
+       SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+                       server->stat.clients + 1));
+       server->stat.clients++;
       }
     }
 
index 9924e8bea740311b2eb083fe2f21eb6ba099b456..9fb4aaf3acb9e1ff9142fc8341c7b38011921d78 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2008 Pekka Riikonen
+  Copyright (C) 1997 - 2009 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -318,9 +318,16 @@ static void silc_server_packet_parse_type(SilcServer server,
 {
   SilcPacketType type = packet->type;
   SilcIDListData idata = silc_packet_get_context(sock);
+#ifdef SILC_DEBUG
+  const char *ip;
+  SilcUInt16 port;
+
+  silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
+                             NULL, NULL, &ip, &port);
+#endif /* SILC_DEBUG */
 
-  SILC_LOG_DEBUG(("Received %s packet [flags %d]",
-                 silc_get_packet_name(type), packet->flags));
+  SILC_LOG_DEBUG(("Received %s packet [flags %d] from %s:%d",
+                 silc_get_packet_name(type), packet->flags, ip, port));
 
   /* Parse the packet type */
   switch (type) {
@@ -5045,6 +5052,10 @@ void silc_server_save_users_on_channel(SilcServer server,
       }
 
       client->data.status |= SILC_IDLIST_STATUS_REGISTERED;
+
+      SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+                     server->stat.clients + 1));
+      server->stat.clients++;
     }
 
     if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED)) {
index 1b8249a561c401a5b36f8f1f19e282b7d8539958..7df4088519be616818d3724b429018df9fcb8a0f 100644 (file)
@@ -42,8 +42,8 @@ silc_server_remove_clients_channels(SilcServer server,
   if (!client)
     return;
 
-  SILC_LOG_DEBUG(("Remove client %s from all channels",
-                client->nickname ? client->nickname :
+  SILC_LOG_DEBUG(("Remove client %p %s from all channels",
+                 client, client->nickname ? client->nickname :
                  (unsigned char *)""));
 
   if (silc_hash_table_find(clients, client, NULL, NULL))
index 9a1cf5bba5f5efde9c7723fc14ed5c74dbafc0ea..21d47d37ce03b1db78dbdecb3cd8a7a75b39f446 100644 (file)
@@ -121,7 +121,7 @@ done
 __SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
 #endif SILC_DIST_TOOLKIT
 
-LT_INIT
+AC_PROG_LIBTOOL
 AC_PROG_RANLIB
 #ifndef SILC_DIST_TOOLKIT
 AC_DISABLE_SHARED
index 22cc82ba5fb2f7d36b8724ec16791975255ef021..8a279ae8c746a3a4a1aaab74efd70451c2023bcb 100644 (file)
@@ -46,4 +46,4 @@ LIBTOOLIZE="libtoolize --automake --copy"
 # Location of the make program.  This must be specified in order to be 
 # able to create distributions.
 #
-MAKE="gmake"
+MAKE="make"