bool silc_server_init(SilcServer server)
{
- int sock;
+ int sock = -1;
SilcServerID *id;
SilcServerEntry id_entry;
SilcIDListPurge purge;
/* Initialize ID caches */
server->local_list->clients =
silc_idcache_alloc(0, SILC_ID_CLIENT, silc_idlist_client_destructor,
- FALSE, TRUE);
+ server, FALSE, TRUE);
server->local_list->servers =
- silc_idcache_alloc(0, SILC_ID_SERVER, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_SERVER, NULL, NULL, FALSE, TRUE);
server->local_list->channels =
- silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, NULL, FALSE, TRUE);
/* These are allocated for normal server as well as these hold some
global information that the server has fetched from its router. For
router these are used as they are supposed to be used on router. */
server->global_list->clients =
silc_idcache_alloc(0, SILC_ID_CLIENT, silc_idlist_client_destructor,
- FALSE, TRUE);
+ server, FALSE, TRUE);
server->global_list->servers =
- silc_idcache_alloc(0, SILC_ID_SERVER, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_SERVER, NULL, NULL, FALSE, TRUE);
server->global_list->channels =
- silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, FALSE, TRUE);
+ silc_idcache_alloc(0, SILC_ID_CHANNEL, NULL, NULL, FALSE, TRUE);
/* Init watcher lists */
server->watcher_list =
*/
if (packet->flags & SILC_PACKET_FLAG_LIST)
break;
+ server->stat.commands_received++;
silc_server_command_process(server, sock, packet);
break;
*/
if (packet->flags & SILC_PACKET_FLAG_LIST)
break;
+ server->stat.commands_received++;
silc_server_command_reply(server, sock, packet);
break;
if (!client || !client->id)
continue;
+ server->stat.commands_sent++;
+
idp = silc_id_payload_encode(client->id, SILC_ID_CLIENT);
args = silc_buffer_alloc_size(2);
silc_buffer_format(args,
if (!server->standalone) {
SILC_LOG_DEBUG(("Retrieving stats from router"));
+ server->stat.commands_sent++;
idp = silc_id_payload_encode(server->router->id, SILC_ID_SERVER);
packet = silc_command_payload_encode_va(SILC_COMMAND_STATS,
++server->cmd_ident, 1,