updates.
authorPekka Riikonen <priikone@silcnet.org>
Mon, 3 Dec 2001 09:52:12 +0000 (09:52 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 3 Dec 2001 09:52:12 +0000 (09:52 +0000)
CHANGES
TODO
apps/silcd/command_reply.c

diff --git a/CHANGES b/CHANGES
index 08d6108c54af38d133d2dea23b0f7c59882fd19e..e261a9c791a6b106b34ed413ff0d2ff199c60f18 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,11 @@
+Mon Dec  3 11:56:59 EET 2001  Pekka Riikonen <priikone@silcnet.org>
+
+       * Use cache entry expire time in the LIST command reply to
+         purge old entries from the cache after the LIST command
+         reply has been received.  This way we don't have non-existent
+         entries in the cache for too long.  Affected file is
+         silcd/command_reply.c.
+
 Sun Dec  2 23:29:07 EET 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * If we are normal server, and we've not resolved client info
diff --git a/TODO b/TODO
index cf5768f04856d31df463d9817094502db83af791..22dbc70afee6ad8179cd9997dffd82488041c628 100644 (file)
--- a/TODO
+++ b/TODO
@@ -39,11 +39,6 @@ TODO/bugs In SILC Client Library
 TODO/bugs In SILC Server
 ========================
 
- o The LIST command reply should empty the global list because
-   it is possible there stay channels that does not exist anymore.
-   Empty it and put channels that server does not know about to 
-   global list.
-
  o Make the silc_server_command_pending_error_check function to
    take all arguments it received and put them to the reply it is 
    sending.  Otherwise for example WHOIS on normal server for bogus
index 7d407edcecf532468bf8346cb892e10cd97ce9be..5bf79b6aaa1b48e3e87d88522c297d165d1562fa 100644 (file)
@@ -1096,6 +1096,7 @@ SILC_SERVER_CMD_REPLY_FUNC(list)
   SilcCommandStatus status;
   SilcChannelID *channel_id = NULL;
   SilcChannelEntry channel;
+  SilcIDCacheEntry cache;
   uint32 len;
   unsigned char *tmp, *name, *topic;
   uint32 usercount = 0;
@@ -1115,12 +1116,12 @@ SILC_SERVER_CMD_REPLY_FUNC(list)
 
   /* Add the channel entry if we do not have it already */
   channel = silc_idlist_find_channel_by_name(server->local_list, 
-                                            name, NULL);
+                                            name, &cache);
   if (!channel)
     channel = silc_idlist_find_channel_by_name(server->global_list, 
-                                              name, NULL);
+                                              name, &cache);
   if (!channel) {
-    /* If router did not find such Channel ID in its lists then this must
+    /* If router did not find such channel in its lists then this must
        be bogus channel or some router in the net is buggy. */
     if (server->server_type != SILC_SERVER)
       goto out;
@@ -1130,7 +1131,16 @@ SILC_SERVER_CMD_REPLY_FUNC(list)
                                      server->router, NULL, NULL);
     if (!channel)
       goto out;
+
+    /* Update cache entry expiry */
+    if (silc_idlist_find_channel_by_id(server->global_list, channel_id, 
+                                      &cache))
+      cache->expire = time(NULL) + 60;
+
     channel_id = NULL;
+  } else {
+    /* Found, update expiry */
+    cache->expire = time(NULL) + 60;
   }
 
   if (topic) {
@@ -1145,6 +1155,10 @@ SILC_SERVER_CMD_REPLY_FUNC(list)
     return;
   }
 
+  /* Now purge all old entries from the global list, otherwise we'll might
+     have non-existent entries for long periods of time in the cache. */
+  silc_idcache_purge(server->global_list->channels);
+
  out:
   SILC_SERVER_PENDING_EXEC(cmd, SILC_COMMAND_LIST);
   SILC_SERVER_PENDING_DESTRUCTOR(cmd, SILC_COMMAND_LIST);