$OpenBSD: patch-apps_silcd_packet_receive_c,v 1.2 2009/01/23 11:01:06 sthen Exp $
--- apps/silcd/packet_receive.c.orig	Thu Jan  8 04:20:01 2009
+++ apps/silcd/packet_receive.c	Sat Jan 17 07:58:27 2009
@@ -186,6 +186,12 @@ static void silc_server_notify_process(SilcServer serv
 	}
 
 	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++;
       }
     }
 
@@ -326,6 +332,8 @@ static void silc_server_notify_process(SilcServer serv
       tmp_len = 128;
 
     /* Update statistics */
+    SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+		    server->stat.clients - 1));
     SILC_VERIFY(server->stat.clients > 0);
     server->stat.clients--;
     if (server->stat.cell_clients)
@@ -1246,6 +1254,8 @@ static void silc_server_notify_process(SilcServer serv
 	    }
 
 	    /* Update statistics */
+	    SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+			    server->stat.clients - 1));
 	    SILC_VERIFY(server->stat.clients > 0);
 	    server->stat.clients--;
 	    if (server->stat.cell_clients)
@@ -1492,6 +1502,8 @@ static void silc_server_notify_process(SilcServer serv
       }
 
       /* Update statistics */
+      SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+		      server->stat.clients - 1));
       SILC_VERIFY(server->stat.clients > 0);
       server->stat.clients--;
       if (server->stat.cell_clients)
@@ -2686,6 +2698,8 @@ static void silc_server_new_id_real(SilcServer server,
 
       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++;
 
       /* Check if anyone is watching this nickname */
@@ -3742,6 +3756,8 @@ void silc_server_resume_client(SilcServer server,
        we decremented the count already during detach, thus we'd be undoing
        that operation. */
     detached_client->local_detached = FALSE;
+    SILC_LOG_DEBUG(("stat.clients %d->%d", server->stat.clients,
+		    server->stat.clients - 1));
     SILC_VERIFY(server->stat.clients > 0);
     server->stat.clients--;
     if (server->stat.cell_clients)
