updates.
authorPekka Riikonen <priikone@silcnet.org>
Tue, 13 Nov 2001 22:22:30 +0000 (22:22 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 13 Nov 2001 22:22:30 +0000 (22:22 +0000)
CHANGES
TODO
lib/silccore/silcidcache.c

diff --git a/CHANGES b/CHANGES
index f1a9c28af612312d7058a2bb60b348dbddd8af55..72c7adf2d8c7e71adf445045d4fa0ad07e552dc6 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,9 @@ Wed Nov 14 00:18:08 EET 2001  Pekka Riikonen <priikone@silcnet.org>
          the dynamic list.  Fixes a crash.  Affected file is
          lib/silccore/silcidcache.c.
 
+       * Fixed the LIST command reply to really call LIST command's
+         pending callbacks.  Affected file silcd/command_reply.c.
+
 Tue Nov 13 00:49:17 EET 2001  Pekka Riikonen <priikone@silcnet.org>
 
        * Update conn->local_entry->nickname after giving NICK
diff --git a/TODO b/TODO
index c631c660f2c5af71ed4afd29e5bcbb9c64a819c0..168e26521c3cbcfe5043bb0c6cf55bc6610b1871 100644 (file)
--- a/TODO
+++ b/TODO
@@ -41,6 +41,8 @@ TODO/bugs In SILC Client Library
 TODO/bugs In SILC Server
 ========================
 
+ o MOTD and INFO does not work with server name.
+
  o After backup resume protocol the TOPIC_SET was not handled correctly
    by all (unknown Channel ID).
 
index 245e4dfb1c40e49334d9480fe17d5dc90862cc22..b922beb7f9cdfca9af3529062572c11b9c6b421b 100644 (file)
@@ -90,6 +90,7 @@ struct SilcIDCacheListStruct {
   uint32 cache_dyn_count;
   uint32 cache_count;
   uint32 pos;
+  bool dyn;
 };
 
 /* Allocates new ID cache object. The initial amount of allocated entries
@@ -499,7 +500,7 @@ static void silc_idcache_list_add(SilcIDCacheList list, SilcIDCacheEntry cache)
 
   /* Try to add to static cache */
   if (!list->cache_dyn_count)
-    for (i = 0; i < sizeof(list->cache); i++) {
+    for (i = 0; i < (sizeof(list->cache) / sizeof(list->cache[0])); i++) {
       if (!list->cache[i]) {
        list->cache[i] = cache;
        list->cache_count++;
@@ -519,17 +520,17 @@ static void silc_idcache_list_add(SilcIDCacheList list, SilcIDCacheEntry cache)
   if (i >= list->cache_dyn_count) {
     int k;
 
-    i += 5;
+    i = list->cache_dyn_count;
     list->cache_dyn = silc_realloc(list->cache_dyn, 
-                                  sizeof(*list->cache) * (i));
+                                  sizeof(*list->cache_dyn) * (i + 5));
 
     /* NULL the reallocated area */
-    for (k = list->cache_dyn_count; k < i; k++)
+    for (k = i; k < (i + 5); k++)
       list->cache_dyn[k] = NULL;
 
-    list->cache_dyn[list->cache_dyn_count] = cache;
-    list->cache_dyn_count = i;
+    list->cache_dyn[i] = cache;
     list->cache_count++;
+    list->cache_dyn_count += 5;
   }
 }
 
@@ -559,25 +560,25 @@ bool silc_idcache_list_first(SilcIDCacheList list, SilcIDCacheEntry *ret)
 
 bool silc_idcache_list_next(SilcIDCacheList list, SilcIDCacheEntry *ret)
 {
-  int dyn = FALSE;
   list->pos++;
 
-  if (list->pos >= sizeof(list->cache)) {
+  if (!list->dyn &&
+      list->pos >= (sizeof(list->cache) / sizeof(list->cache[0]))) {
     list->pos = 0;
-    dyn = TRUE;
+    list->dyn = TRUE;
   }
 
-  if (dyn && list->pos >= list->cache_dyn_count)
+  if (list->dyn && list->pos >= list->cache_dyn_count)
     return FALSE;
 
-  if (!dyn && !list->cache[list->pos])
+  if (!list->dyn && !list->cache[list->pos])
     return FALSE;
   
-  if (dyn && !list->cache_dyn[list->pos])
+  if (list->dyn && !list->cache_dyn[list->pos])
     return FALSE;
   
   if (ret) {
-    if (!dyn)
+    if (!list->dyn)
       *ret = list->cache[list->pos];
     else
       *ret = list->cache_dyn[list->pos];