diff options
author | Roger Dingledine <arma@torproject.org> | 2005-01-07 15:57:57 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-01-07 15:57:57 +0000 |
commit | f468ff04eaebba7c761f62b2b96b03a3add95454 (patch) | |
tree | e08df9ad6c1ce186b1eeec91379a2925c2106b73 /src/or/circuituse.c | |
parent | 31227f0292775ad30743a6149145db876e0e172c (diff) | |
download | tor-f468ff04eaebba7c761f62b2b96b03a3add95454.tar tor-f468ff04eaebba7c761f62b2b96b03a3add95454.tar.gz |
when we haven't fetched a directory yet, or the last time we
tried they were all unreachable, assume we are not connected to
the network.
when an application request comes in during this state, be
optimistic and assume we just reconnected. fetch a new directory
and if it works, begin making circuits.
svn:r3327
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index dcd92af8b..2e7169b7c 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -717,6 +717,18 @@ circuit_get_open_circ_or_launch(connection_t *conn, return 1; /* we're happy */ } + if (!has_fetched_directory) { + if (!connection_get_by_type(CONN_TYPE_DIR)) { + log_fn(LOG_NOTICE,"Application request when we're believed to be offline. Optimistically trying again."); + directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR, NULL, 1); + } + /* the stream will be dealt with when has_fetched_directory becomes + * 1, or when all directory attempts fail and directory_all_unreachable() + * kills it. + */ + return 0; + } + /* Do we need to check exit policy? */ if (!is_resolve && !connection_edge_is_rendezvous_stream(conn)) { addr = client_dns_lookup_entry(conn->socks_request->address); |