updates.
[silc.git] / lib / silccore / silcidcache.c
index c4b658e80ed02f3827d06ad687de3c154e9577e1..5cf2533af07d99bf5fae68e32c14b6a9f43f9952 100644 (file)
@@ -142,10 +142,9 @@ void silc_idcache_free(SilcIDCache cache)
    the entry never expires from the cache. */
 
 bool silc_idcache_add(SilcIDCache cache, char *name, void *id, 
-                     void *context, int expire)
+                     void *context, int expire, SilcIDCacheEntry *ret)
 {
   SilcIDCacheEntry c;
-  uint32 curtime = time(NULL);
 
   SILC_LOG_DEBUG(("Adding cache entry"));
 
@@ -153,7 +152,7 @@ bool silc_idcache_add(SilcIDCache cache, char *name, void *id,
   c = silc_calloc(1, sizeof(*c));
   c->id = id;
   c->name = name;
-  c->expire = (expire ? (curtime + SILC_ID_CACHE_EXPIRE) : 0);
+  c->expire = expire;
   c->context = context;
 
   /* Add the new entry to the hash tables */
@@ -173,6 +172,9 @@ bool silc_idcache_add(SilcIDCache cache, char *name, void *id,
     silc_hash_table_rehash(cache->context_table, 0);
   }
 
+  if (ret)
+    *ret = c;
+
   return TRUE;
 }