[or-cvs] bugfix: if a circuit if borderline too old, then count it a...
Roger Dingledine
arma at seul.org
Sat May 15 07:21:27 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuituse.c or.h relay.c
Log Message:
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).
Index: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuituse.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- circuituse.c 13 May 2004 07:24:49 -0000 1.1
+++ circuituse.c 15 May 2004 07:21:24 -0000 1.2
@@ -56,7 +56,7 @@
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) {
Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.347
retrieving revision 1.348
diff -u -d -r1.347 -r1.348
--- or.h 13 May 2004 07:24:49 -0000 1.347
+++ or.h 15 May 2004 07:21:25 -0000 1.348
@@ -1149,8 +1149,6 @@
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);
Index: relay.c
===================================================================
RCS file: /home/or/cvsroot/src/or/relay.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- relay.c 13 May 2004 07:24:49 -0000 1.2
+++ relay.c 15 May 2004 07:21:25 -0000 1.3
@@ -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 @@
* - 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 @@
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 */
More information about the tor-commits
mailing list