Fixed notify sending to backup routers, and fixed channel
[silc.git] / apps / silcd / server_util.c
index d0157e3a5736740679016c5d45476dcfdb3862bf..183819318d3a9a52fc295315aa3dc57517731586 100644 (file)
@@ -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. */