bool silc_server_init(SilcServer server)
{
- int sock;
+ int sock = -1;
SilcServerID *id;
SilcServerEntry id_entry;
SilcIDListPurge purge;
#ifdef SILC_DEBUG
/* Set debugging on if configured */
if (server->config->debug_string) {
- silc_debug = TRUE;
+ silc_log_debug(TRUE);
silc_log_set_debug_string(server->config->debug_string);
}
#endif /* SILC_DEBUG */
/* 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 =
SILC_LOG_INFO(("Rehashing server"));
/* Reset the logging system */
- silc_log_quick = TRUE;
+ silc_log_quick(TRUE);
silc_log_flush_all();
/* Start the main rehash phase (read again the config file) */
#ifdef SILC_DEBUG
/* Set debugging on if configured */
if (server->config->debug_string) {
- silc_debug = TRUE;
+ silc_log_debug(TRUE);
silc_log_set_debug_string(server->config->debug_string);
}
#endif /* SILC_DEBUG */
*/
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;
SilcUInt32 key_len)
{
int i;
- unsigned char channel_key[32], hash[32];
+ unsigned char channel_key[32], hash[SILC_HASH_MAXLEN];
SilcUInt32 len;
if (channel->mode & SILC_CHANNEL_MODE_PRIVKEY) {
{
SilcChannelKeyPayload payload = NULL;
SilcChannelID *id = NULL;
- unsigned char *tmp, hash[32];
+ unsigned char *tmp, hash[SILC_HASH_MAXLEN];
SilcUInt32 tmp_len;
char *cipher;
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,