Browse Source

another api tweak to help task 1944

Roger Dingledine 14 years ago
parent
commit
c2c1f5b2a1
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/or/rendclient.c

+ 5 - 3
src/or/rendclient.c

@@ -363,10 +363,10 @@ lookup_last_hid_serv_request(routerstatus_t *hs_dir,
  * it does not contain requests older than REND_HID_SERV_DIR_REQUERY_PERIOD
  * seconds any more. */
 static void
-directory_clean_last_hid_serv_requests(void)
+directory_clean_last_hid_serv_requests(time_t now)
 {
   strmap_iter_t *iter;
-  time_t cutoff = time(NULL) - REND_HID_SERV_DIR_REQUERY_PERIOD;
+  time_t cutoff = now - REND_HID_SERV_DIR_REQUERY_PERIOD;
   if (!last_hid_serv_requests)
     last_hid_serv_requests = strmap_new();
   for (iter = strmap_iter_init(last_hid_serv_requests);
@@ -411,7 +411,9 @@ directory_get_from_hs_dir(const char *desc_id, const rend_data_t *rend_query)
 
   /* Only select those hidden service directories to which we did not send
    * a request recently and for which we have a router descriptor here. */
-  directory_clean_last_hid_serv_requests(); /* Clean request history first. */
+
+  /* Clean request history first. */
+  directory_clean_last_hid_serv_requests(now);
 
   SMARTLIST_FOREACH(responsible_dirs, routerstatus_t *, dir, {
     if (lookup_last_hid_serv_request(dir, desc_id_base32, 0, 0) +