+Tue Mar 9 17:11:58 EET 2004 Pekka Riikonen <priikone@silcnet.org>
+
+ * Check the number of connections from real number of
+ connections instead of socket number, when deciding if
+ server is full. Affected files are silcd/server.c,
+ server_internal.h and silcd.c.
+
Wed Mar 3 15:13:49 CET 2004 Pekka Riikonen <priikone@silcnet.org>
* Fixed crashbug in connection closing, after a protocol
} else {
silc_socket_free(server->sockets[i]);
server->sockets[i] = NULL;
+ server->stat.conn_num--;
}
}
}
/* Check for maximum allowed connections */
- if (sock > server->config->param.connections_max) {
+ if (server->stat.conn_num > server->config->param.connections_max) {
SILC_LOG_ERROR(("Refusing connection, server is full"));
server->stat.conn_failures++;
silc_net_close_connection(sock);
return;
}
+ server->stat.conn_num++;
/* Set socket options */
silc_net_set_socket_nonblock(sock);
/* Close the actual connection */
silc_net_close_connection(sock->sock);
server->sockets[sock->sock] = NULL;
+ server->stat.conn_num--;
/* We won't listen for this connection anymore */
silc_schedule_task_del_by_fd(server->schedule, sock->sock);
SilcUInt32 auth_failures; /* Authentication failures */
SilcUInt32 packets_sent; /* Sent SILC packets */
SilcUInt32 packets_received; /* Received SILC packets */
+ SilcUInt32 conn_num; /* Number of connections */
} SilcServerStatistics;
/*
if (server->stat.cell_clients && server->stat.cell_servers + 1)
SILC_SERVER_SEND_NOTIFY(server, sock, SILC_NOTIFY_TYPE_NONE,
- ("There are %d clients on %d server in our cell",
+ ("There are %d clients on %d servers in our cell",
server->stat.cell_clients,
server->stat.cell_servers));
if (server->server_type == SILC_ROUTER) {
STAT_OUTPUT(" Authentication failures : %d", silcd->stat.auth_failures);
STAT_OUTPUT(" Packets sent : %d", silcd->stat.packets_sent);
STAT_OUTPUT(" Packets received : %d", silcd->stat.packets_received);
+ STAT_OUTPUT(" Connections : %d", silcd->stat.conn_num);
#undef STAT_OUTPUT