Commit 04bb8c80 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

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
parent 09a47485
Loading
Loading
Loading
Loading
+1 −1
Changes for src/or/circuituse.c: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static int circuit_is_acceptable(circuit_t *circ,

  if(purpose == CIRCUIT_PURPOSE_C_GENERAL)
    if(circ->timestamp_dirty &&
       circ->timestamp_dirty+options.NewCircuitPeriod < now)
       circ->timestamp_dirty+options.NewCircuitPeriod <= now)
      return 0;

  if(conn) {
+0 −2
Changes for src/or/or.h: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -1149,8 +1149,6 @@ extern unsigned long stats_n_relay_cells_delivered;

int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
                               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_unpack(relay_header_t *dest, const char *src);
+10 −1
Changes for src/or/relay.c: 10 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@

#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,
                crypt_path_t **layer_hint, char *recognized);
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
 *  - connection_or_write_cell_to_buf to the right conn
 */
int
static int
circuit_package_relay_cell(cell_t *cell, circuit_t *circ,
                           int cell_direction,
                           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)
          < MAX_RESOLVE_FAILURES) {
        /* 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;
        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)
          return 0;
        /* else, conn will get closed below */