diff options
author | Roger Dingledine <arma@torproject.org> | 2008-01-24 22:49:14 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-01-24 22:49:14 +0000 |
commit | d262fff20d7cf99363e21df98204e9cc530c2c88 (patch) | |
tree | 2f1f7a25eed209df78303be2dd9d984bfe4a17fb /src/or/directory.c | |
parent | 0ddd28b75ec493bc763ef70b83d5323d4c2dab34 (diff) | |
download | tor-d262fff20d7cf99363e21df98204e9cc530c2c88.tar.gz tor-d262fff20d7cf99363e21df98204e9cc530c2c88.zip |
patch "15" from karsten: don't retry a v2 renddesc fetch
if we have a perfectly good v0 renddesc.
svn:r13265
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index b492d75527..8e0f9b0e0f 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -1798,16 +1798,27 @@ connection_dir_client_reached_eof(dir_connection_t *conn) (int)body_len, status_code, escaped(reason)); switch (status_code) { case 200: - if (rend_cache_store_v2_desc_as_client(body, NULL) < 0) { - log_warn(LD_REND,"Fetching v2 rendezvous descriptor failed. " - "Retrying at another directory."); - /* We'll retry when connection_about_to_close_connection() - * cleans this dir conn up. */ - } else { - /* success. notify pending connections about this. */ - log_info(LD_REND, "Successfully fetched rendezvous descriptor."); - conn->_base.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC; - rend_client_desc_here(conn->rend_query); + switch (rend_cache_store_v2_desc_as_client(body, NULL)) { + case -2: + log_warn(LD_REND,"Fetching v2 rendezvous descriptor failed. " + "Retrying at another directory."); + /* We'll retry when connection_about_to_close_connection() + * cleans this dir conn up. */ + break; + case -1: + /* We already have a v0 descriptor here. Ignoring this one + * and _not_ performing another request. */ + log_info(LD_REND, "Successfully fetched v2 rendezvous " + "descriptor, but we already have a v0 descriptor."); + conn->_base.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC; + break; + default: + /* success. notify pending connections about this. */ + log_info(LD_REND, "Successfully fetched v2 rendezvous " + "descriptor."); + conn->_base.purpose = DIR_PURPOSE_HAS_FETCHED_RENDDESC; + rend_client_desc_here(conn->rend_query); + break; } break; case 404: |