From aa25bf14052ca908dd892231d3e23561de3d55d9 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Fri, 25 Jan 2008 07:22:42 +0000 Subject: a slightly better interface for hid_serv_get_responsible_directories() svn:r13271 --- src/or/routerlist.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/or/routerlist.c') diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 76365b5dfd..6d511ddb4d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -4423,7 +4423,8 @@ routers_sort_by_identity(smartlist_t *routers) /** Determine the routers that are responsible for id (binary) and * add pointers to those routers' routerstatus_t to responsible_dirs. - * 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 @@ hid_serv_get_responsible_directories(smartlist_t *responsible_dirs, } 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 @@ hid_serv_responsible_for_desc_id(const char *query) 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; } -- cgit v1.2.3-54-g00ecf