diff options
author | Robert Ransom <rransom.8774@gmail.com> | 2011-09-17 03:23:26 -0700 |
---|---|---|
committer | Robert Ransom <rransom.8774@gmail.com> | 2011-10-02 12:49:35 -0700 |
commit | 34a6b8b7e588b6f10e6e87cf876ef6ada49f8b8a (patch) | |
tree | 200537b33bfeb739bc15e34f565405ae7bfc1655 /src/or/rendclient.c | |
parent | eaed37d14c6e1dc93a392f62ef2e501f75e4878a (diff) | |
download | tor-34a6b8b7e588b6f10e6e87cf876ef6ada49f8b8a.tar.gz tor-34a6b8b7e588b6f10e6e87cf876ef6ada49f8b8a.zip |
Clear the timed_out flag when an HS connection attempt ends
Diffstat (limited to 'src/or/rendclient.c')
-rw-r--r-- | src/or/rendclient.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/or/rendclient.c b/src/or/rendclient.c index 013d5441f3..3c1c116af5 100644 --- a/src/or/rendclient.c +++ b/src/or/rendclient.c @@ -881,10 +881,33 @@ rend_client_desc_trynow(const char *query) "unavailable (try again later).", safe_str_client(query)); connection_mark_unattached_ap(conn, END_STREAM_REASON_RESOLVEFAILED); + rend_client_note_connection_attempt_ended(query); } } SMARTLIST_FOREACH_END(_conn); } +/** Clear temporary state used only during an attempt to connect to + * the hidden service named <b>onion_address</b>. Called when a + * connection attempt has ended; may be called occasionally at other + * times, and should be reasonably harmless. */ +void +rend_client_note_connection_attempt_ended(const char *onion_address) +{ + rend_cache_entry_t *cache_entry = NULL; + rend_cache_lookup_entry(onion_address, -1, &cache_entry); + + log_info(LD_REND, "Connection attempt for %s has ended; " + "cleaning up temporary state.", + safe_str_client(onion_address)); + + /* Clear the timed_out flag on all remaining intro points for this HS. */ + if (cache_entry != NULL) { + SMARTLIST_FOREACH(cache_entry->parsed->intro_nodes, + rend_intro_point_t *, ip, + ip->timed_out = 0; ); + } +} + /** Return a newly allocated extend_info_t* for a randomly chosen introduction * point for the named hidden service. Return NULL if all introduction points * have been tried and failed. |