+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
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
SilcCommandStatus status;
SilcChannelID *channel_id = NULL;
SilcChannelEntry channel;
+ SilcIDCacheEntry cache;
uint32 len;
unsigned char *tmp, *name, *topic;
uint32 usercount = 0;
/* 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;
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) {
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);