[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r13271: a slightly better interface for hid_serv_get_responsible_dir (tor/trunk/src/or)



Author: arma
Date: 2008-01-25 02:22:42 -0500 (Fri, 25 Jan 2008)
New Revision: 13271

Modified:
   tor/trunk/src/or/routerlist.c
Log:
a slightly better interface for hid_serv_get_responsible_directories()


Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2008-01-25 07:11:32 UTC (rev 13270)
+++ tor/trunk/src/or/routerlist.c	2008-01-25 07:22:42 UTC (rev 13271)
@@ -4423,7 +4423,8 @@
 
 /** Determine the routers that are responsible for <b>id</b> (binary) and
  * add pointers to those routers' routerstatus_t to <b>responsible_dirs</b>.
- * If we don't have a consensus, return -1, else 0. */
+ * Return -1 if we're returning an empty smartlist, else return 0.
+ */
 int
 hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
                                      const char *id)
@@ -4451,8 +4452,8 @@
   } while (i != start);
 
   /* Even though we don't have the desired number of hidden service
-   * directories, we are happy with what we got. */
-  return 0;
+   * directories, be happy if we got any. */
+  return smartlist_len(responsible_dirs) ? 0 : -1;
 }
 
 /** Return true if this node is currently acting as hidden service
@@ -4505,8 +4506,7 @@
     return 0; /* This is redundant, but let's be paranoid. */
   my_id = me->cache_info.identity_digest;
   responsible = smartlist_create();
-  (int) hid_serv_get_responsible_directories(responsible, query);
-  if (!smartlist_len(responsible)) {
+  if (hid_serv_get_responsible_directories(responsible, query) < 0) {
     smartlist_free(responsible);
     return 0;
   }