From: Pekka Riikonen Date: Mon, 3 Dec 2001 09:52:12 +0000 (+0000) Subject: updates. X-Git-Tag: silc.toolkit.0.7~1 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=5993e1c1b51482a1c9ea55b4f1abb833fef817c9 updates. --- diff --git a/CHANGES b/CHANGES index 08d6108c..e261a9c7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,11 @@ +Mon Dec 3 11:56:59 EET 2001 Pekka Riikonen + + * 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 * If we are normal server, and we've not resolved client info diff --git a/TODO b/TODO index cf5768f0..22dbc70a 100644 --- 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 diff --git a/apps/silcd/command_reply.c b/apps/silcd/command_reply.c index 7d407edc..5bf79b6a 100644 --- a/apps/silcd/command_reply.c +++ b/apps/silcd/command_reply.c @@ -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);