X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=apps%2Fsilcd%2Fserver_util.c;h=183819318d3a9a52fc295315aa3dc57517731586;hb=ccfbb5f7a211591c8e5503c99ac3333f469bbe83;hp=d0157e3a5736740679016c5d45476dcfdb3862bf;hpb=7259f22011c133f54062f2b9ab3838ba47e2b539;p=silc.git diff --git a/apps/silcd/server_util.c b/apps/silcd/server_util.c index d0157e3a..18381931 100644 --- a/apps/silcd/server_util.c +++ b/apps/silcd/server_util.c @@ -55,7 +55,7 @@ silc_server_remove_clients_channels(SilcServer server, /* Remove channel if this is last client leaving the channel, unless the channel is permanent. */ - if (server->server_type == SILC_ROUTER && + if (server->server_type != SILC_SERVER && silc_hash_table_count(channel->user_list) < 2) { if (silc_hash_table_find(channels, channel, NULL, NULL)) silc_hash_table_del(channels, channel); @@ -87,7 +87,7 @@ silc_server_remove_clients_channels(SilcServer server, /* If there is not at least one local user on the channel then we don't need the channel entry anymore, we can remove it safely, unless the channel is permanent channel */ - if (server->server_type != SILC_ROUTER && + if (server->server_type == SILC_SERVER && !silc_server_channel_has_local(channel)) { if (silc_hash_table_find(channels, channel, NULL, NULL)) silc_hash_table_del(channels, channel); @@ -325,6 +325,12 @@ bool silc_server_remove_clients_by_server(SilcServer server, silc_hash_table_free(clients); } + /* Return now if we are shutting down */ + if (server->server_shutdown) { + silc_hash_table_free(channels); + return TRUE; + } + /* We must now re-generate the channel key for all channels that had this server's client(s) on the channel. As they left the channel we must re-generate the channel key. */