When disabled channel is found on normal server in JOIN, do
authorPekka Riikonen <priikone@silcnet.org>
Sat, 7 Sep 2002 19:36:21 +0000 (19:36 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 7 Sep 2002 19:36:21 +0000 (19:36 +0000)
not re-create the channel to avoid duplicates.

CHANGES
TODO
apps/silcd/command.c
apps/silcd/server.c
apps/silcd/server_util.c

diff --git a/CHANGES b/CHANGES
index 7f37de795d86f6e3bf8cf6f2dd043b0699b8a0c6..e2348abdda7633b34f577cb40dca23ff012dbce8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Sat Sep  7 22:26:50 EEST 2002  Pekka Riikonen <priikone@silcnet.org>
+
+       * If normal server is standalone and found existing but disabled
+         channel, do not re-create the channel since it creates
+         duplicate same channels.  Affected file silcd/server.c.
+
 Sat Sep  7 16:02:09 EEST 2002  Pekka Riikonen <priikone@silcnet.org>
 
        * In JOIN notify handling, mark that the cache entry of the
diff --git a/TODO b/TODO
index 5e91d50ec5084b246e82a7c6d91ab2ad5c0d9ec0..3e8e5a893d4022827dc676d88412869ab10535ca 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,8 +1,6 @@
 TODO/bugs in Irssi SILC client
 ==============================
 
- o /NAMES list is not emptied when /LEAVEin the channel.
-
  o UTF-8 encode/decode WHOIS userinfos, topic, etc.
 
  o Add STATS.
@@ -25,6 +23,10 @@ TODO/bugs In SILC Client Library
 TODO/bugs In SILC Server
 ========================
 
+ o Backup router can accidently free its own id_entry and ID?  Could happen
+   when some server is connecting and connecting fails (like too many
+   connections, etc).  Some weird crashes relating to this occurred.
+
  o Implement the <Requested Attributes> and the Attribute Payload to
    the core library, client and server.  Maybe implementations of
    RFC 2425 and RFC 2426 to make it complete.
index 2790042ee907814db0965777dfd8ac5a350a8c06..086836c5645b65fc17cd9b6e1a8574d3d001f671 100644 (file)
@@ -3583,26 +3583,27 @@ SILC_SERVER_CMD_FUNC(join)
 
     if (!channel || 
        (channel->disabled && server->server_type != SILC_ROUTER)) {
-      /* Channel not found */
+      /* Channel not found or not valid */
 
       /* If we are standalone server we don't have a router, we just create 
-        the channel by ourselves. */
+        the channel by ourselves (unless it existed). */
       if (server->standalone) {
-       channel = silc_server_create_new_channel(server, server->id, cipher, 
-                                                hmac, channel_name, TRUE);
        if (!channel) {
-         silc_server_command_send_status_reply(
-                                        cmd, SILC_COMMAND_JOIN,
-                                        SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
-                                        0);
-         silc_free(client_id);
-         goto out;
-       }
-       
-       umode = (SILC_CHANNEL_UMODE_CHANOP | SILC_CHANNEL_UMODE_CHANFO);
-       created = TRUE;
-       create_key = FALSE;
+         channel = silc_server_create_new_channel(server, server->id, cipher, 
+                                                  hmac, channel_name, TRUE);
+         if (!channel) {
+           silc_server_command_send_status_reply(
+                                 cmd, SILC_COMMAND_JOIN,
+                                 SILC_STATUS_ERR_UNKNOWN_ALGORITHM,
+                                 0);
+           silc_free(client_id);
+           goto out;
+         }
        
+         umode = (SILC_CHANNEL_UMODE_CHANOP | SILC_CHANNEL_UMODE_CHANFO);
+         created = TRUE;
+         create_key = FALSE;
+       }
       } else {
 
        /* The channel does not exist on our server. If we are normal server 
index 2d739f8a11e84870bed2edd40298efe1ec797a79..f95613aae683ff5e849f1d67d084e323d2cb87d6 100644 (file)
@@ -1369,6 +1369,7 @@ SILC_TASK_CALLBACK(silc_server_connect_to_router_final)
   if (!sconn->backup) {
     /* Mark this router our primary router if we're still standalone */
     if (server->standalone) {
+      SILC_LOG_DEBUG(("This connection is our primary router"));
       server->id_entry->router = id_entry;
       server->router = id_entry;
       server->standalone = FALSE;
index 27077f6820c305de990c8f1a6e62d67727850a91..59102d13b1f81fedbf7b2e7585eedac037ce9f98 100644 (file)
@@ -176,7 +176,7 @@ bool silc_server_remove_clients_by_server(SilcServer server,
        client = (SilcClientEntry)id_cache->context;
 
        /* If client is not registered, is not originated from `router'
-          or is not owned by `entry', skip it. */
+          and is not owned by `entry', skip it. */
        if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED) ||
            client->router != router ||
            (router != entry && !SILC_ID_COMPARE(client->id, entry->id,
@@ -236,7 +236,7 @@ bool silc_server_remove_clients_by_server(SilcServer server,
        client = (SilcClientEntry)id_cache->context;
 
        /* If client is not registered, is not originated from `router'
-          or is not owned by `entry', skip it. */
+          and is not owned by `entry', skip it. */
        if (!(client->data.status & SILC_IDLIST_STATUS_REGISTERED) ||
            client->router != router ||
            (router != entry && !SILC_ID_COMPARE(client->id, entry->id,