diff options
author | Roger Dingledine <arma@torproject.org> | 2008-01-25 07:22:42 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-01-25 07:22:42 +0000 |
commit | aa25bf14052ca908dd892231d3e23561de3d55d9 (patch) | |
tree | 892555444db3496b50c55e4bfdc7a1d0678a268d /src/or/routerlist.c | |
parent | 5fcc79185f6dc100ecdd1341953c1f2fbe6692ec (diff) | |
download | tor-aa25bf14052ca908dd892231d3e23561de3d55d9.tar.gz tor-aa25bf14052ca908dd892231d3e23561de3d55d9.zip |
a slightly better interface for hid_serv_get_responsible_directories()
svn:r13271
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 10 |
1 files changed, 5 insertions, 5 deletions
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 <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 @@ 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; } |