mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
bugfix: if a circuit if borderline too old, then count it as too old.
bugfix: we were retrying the same circuit after getting a resolve failure. so of course the next two tries would fail too. now we try a new circuit each time (at most three times). svn:r1867
This commit is contained in:
parent
09a4748578
commit
04bb8c8046
@ -56,7 +56,7 @@ static int circuit_is_acceptable(circuit_t *circ,
|
|||||||
|
|
||||||
if(purpose == CIRCUIT_PURPOSE_C_GENERAL)
|
if(purpose == CIRCUIT_PURPOSE_C_GENERAL)
|
||||||
if(circ->timestamp_dirty &&
|
if(circ->timestamp_dirty &&
|
||||||
circ->timestamp_dirty+options.NewCircuitPeriod < now)
|
circ->timestamp_dirty+options.NewCircuitPeriod <= now)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(conn) {
|
if(conn) {
|
||||||
|
@ -1149,8 +1149,6 @@ extern unsigned long stats_n_relay_cells_delivered;
|
|||||||
|
|
||||||
int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
|
int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
|
||||||
int cell_direction);
|
int cell_direction);
|
||||||
int circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
|
|
||||||
int cell_direction, crypt_path_t *layer_hint);
|
|
||||||
|
|
||||||
void relay_header_pack(char *dest, const relay_header_t *src);
|
void relay_header_pack(char *dest, const relay_header_t *src);
|
||||||
void relay_header_unpack(relay_header_t *dest, const char *src);
|
void relay_header_unpack(relay_header_t *dest, const char *src);
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "or.h"
|
#include "or.h"
|
||||||
|
|
||||||
|
extern or_options_t options; /* command-line and config-file options */
|
||||||
|
|
||||||
static int relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
|
static int relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
|
||||||
crypt_path_t **layer_hint, char *recognized);
|
crypt_path_t **layer_hint, char *recognized);
|
||||||
static connection_t *relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction);
|
static connection_t *relay_lookup_conn(circuit_t *circ, cell_t *cell, int cell_direction);
|
||||||
@ -281,7 +283,7 @@ static int relay_crypt(circuit_t *circ, cell_t *cell, int cell_direction,
|
|||||||
* - Encrypt it to the right layer
|
* - Encrypt it to the right layer
|
||||||
* - connection_or_write_cell_to_buf to the right conn
|
* - connection_or_write_cell_to_buf to the right conn
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
|
circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
|
||||||
int cell_direction,
|
int cell_direction,
|
||||||
crypt_path_t *layer_hint)
|
crypt_path_t *layer_hint)
|
||||||
@ -509,8 +511,15 @@ connection_edge_process_relay_cell_not_open(
|
|||||||
if (client_dns_incr_failures(conn->socks_request->address)
|
if (client_dns_incr_failures(conn->socks_request->address)
|
||||||
< MAX_RESOLVE_FAILURES) {
|
< MAX_RESOLVE_FAILURES) {
|
||||||
/* We haven't retried too many times; reattach the connection. */
|
/* We haven't retried too many times; reattach the connection. */
|
||||||
|
log_fn(LOG_INFO,"Resolve of '%s' failed, trying again.",
|
||||||
|
conn->socks_request->address);
|
||||||
|
circuit_log_path(LOG_INFO,circ);
|
||||||
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
|
conn->state = AP_CONN_STATE_CIRCUIT_WAIT;
|
||||||
circuit_detach_stream(circ,conn);
|
circuit_detach_stream(circ,conn);
|
||||||
|
tor_assert(circ->timestamp_dirty);
|
||||||
|
circ->timestamp_dirty -= options.NewCircuitPeriod;
|
||||||
|
/* make sure not to expire/retry the stream quite yet */
|
||||||
|
conn->timestamp_lastread = time(NULL);
|
||||||
if(connection_ap_handshake_attach_circuit(conn) >= 0)
|
if(connection_ap_handshake_attach_circuit(conn) >= 0)
|
||||||
return 0;
|
return 0;
|
||||||
/* else, conn will get closed below */
|
/* else, conn will get closed below */
|
||||||
|
Loading…
Reference in New Issue
Block a user