patch "14a" from karsten: don't fail if we can't find

REND_NUMBER_OF_CONSECUTIVE_REPLICAS v2 hsdirs.


svn:r13263
This commit is contained in:
Roger Dingledine 2008-01-24 22:46:29 +00:00
parent ab79f53206
commit cbe9863422
4 changed files with 13 additions and 12 deletions

View File

@ -3208,9 +3208,7 @@ directory_post_to_hs_dir(smartlist_t *descs, const char *service_id,
smartlist_free(responsible_dirs); smartlist_free(responsible_dirs);
return; return;
} }
tor_assert(smartlist_len(responsible_dirs) == for (j = 0; j < smartlist_len(responsible_dirs); j++) {
REND_NUMBER_OF_CONSECUTIVE_REPLICAS);
for (j = 0; j < REND_NUMBER_OF_CONSECUTIVE_REPLICAS; j++) {
char desc_id_base32[REND_DESC_ID_V2_LEN_BASE32 + 1]; char desc_id_base32[REND_DESC_ID_V2_LEN_BASE32 + 1];
hs_dir = smartlist_get(responsible_dirs, j); hs_dir = smartlist_get(responsible_dirs, j);
/* Send publish request. */ /* Send publish request. */

View File

@ -3953,7 +3953,9 @@ void routerlist_assert_ok(routerlist_t *rl);
const char *esc_router_info(routerinfo_t *router); const char *esc_router_info(routerinfo_t *router);
void routers_sort_by_identity(smartlist_t *routers); void routers_sort_by_identity(smartlist_t *routers);
#if 0
int hid_serv_have_enough_directories(void); int hid_serv_have_enough_directories(void);
#endif
int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs, int hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
const char *id); const char *id);
#if 0 #if 0

View File

@ -1076,7 +1076,8 @@ upload_service_descriptor(rend_service_t *service)
/* Upload v2 descriptor? */ /* Upload v2 descriptor? */
if (service->descriptor_version == 2 && if (service->descriptor_version == 2 &&
get_options()->PublishHidServDescriptors) { get_options()->PublishHidServDescriptors) {
if (hid_serv_have_enough_directories()) { networkstatus_vote_t *c = networkstatus_get_latest_consensus();
if (c && smartlist_len(c->routerstatus_list) > 0) {
int seconds_valid; int seconds_valid;
smartlist_t *descs = smartlist_create(); smartlist_t *descs = smartlist_create();
int i; int i;

View File

@ -4474,6 +4474,7 @@ hid_serv_previous_directory(const char *id)
} }
#endif #endif
#if 0
/** Return true, if we are aware of enough hidden service directory to /** Return true, if we are aware of enough hidden service directory to
* usefully perform v2 rend operations on them (publish, fetch, replicate), * usefully perform v2 rend operations on them (publish, fetch, replicate),
* or false otherwise. */ * or false otherwise. */
@ -4494,11 +4495,11 @@ hid_serv_have_enough_directories(void)
}); });
return 0; return 0;
} }
#endif
/** Determine the REND_NUMBER_OF_CONSECUTIVE_REPLICAS routers that are /** Determine the routers that are responsible for <b>id</b> (binary) and
* responsible for <b>id</b> (binary) and add pointers to those routers' * add pointers to those routers' routerstatus_t to <b>responsible_dirs</b>.
* routerstatus_t to <b>responsible_dirs</b>. If we don't have enough * If we don't have a consensus, return -1, else 0. */
* hidden service directories, return -1, else 0. */
int int
hid_serv_get_responsible_directories(smartlist_t *responsible_dirs, hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
const char *id) const char *id)
@ -4525,10 +4526,9 @@ hid_serv_get_responsible_directories(smartlist_t *responsible_dirs,
i = 0; i = 0;
} while (i != start); } while (i != start);
/* XXX020 make this louder once we have some v2hidservs */ /* Even though we don't have the desired number of hidden service
log_info(LD_REND, "We don't have enough hidden service directories to " * directories, we are happy with what we got. */
"perform v2 rendezvous operations!"); return 0;
return -1;
} }
/** Return true if this node is currently acting as hidden service /** Return true if this node is currently acting as hidden service