fix the first bug with our optimization to circuit_expire_building():

we were killing off rendezvous circuits unless they magically time-warped
to be too old before we got around to killing them, in which case we
would leave them alone. this made it hard to rendezvous with hidden
services.


svn:r5494
This commit is contained in:
Roger Dingledine 2005-12-04 21:51:50 +00:00
parent 1b0134dda8
commit d60f514f4c

View File

@ -219,7 +219,6 @@ circuit_expire_building(time_t now)
} }
#endif #endif
/* if circ is !open, or if it's open but purpose is a non-finished /* if circ is !open, or if it's open but purpose is a non-finished
* intro or rend, then mark it for close */ * intro or rend, then mark it for close */
if (victim->state == CIRCUIT_STATE_OPEN) { if (victim->state == CIRCUIT_STATE_OPEN) {
@ -232,20 +231,21 @@ circuit_expire_building(time_t now)
* IS_ORIGIN test above. */ * IS_ORIGIN test above. */
continue; /* yes, continue inside a switch refers to the nearest continue; /* yes, continue inside a switch refers to the nearest
* enclosing loop. C is smart. */ * enclosing loop. C is smart. */
case CIRCUIT_PURPOSE_C_ESTABLISH_REND: case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
case CIRCUIT_PURPOSE_C_INTRODUCING: case CIRCUIT_PURPOSE_C_INTRODUCING:
case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO: case CIRCUIT_PURPOSE_S_ESTABLISH_INTRO:
break; break;
case CIRCUIT_PURPOSE_C_REND_READY: case CIRCUIT_PURPOSE_C_REND_READY:
/* it's a rend_ready circ -- has it already picked a query? */ /* it's a rend_ready circ -- has it already picked a query? */
if (!victim->rend_query[0] && victim->timestamp_dirty > cutoff) /* c_rend_ready circs measure age since timestamp_dirty,
* because that's set when they switch purposes
*/
if (!victim->rend_query[0] || victim->timestamp_dirty <= cutoff)
continue; continue;
break; break;
case CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED: case CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED:
case CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT: case CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT:
/* c_rend_ready circs measure age since timestamp_dirty,
* because that's set when they switch purposes
*/
/* rend and intro circs become dirty each time they /* rend and intro circs become dirty each time they
* make an introduction attempt. so timestamp_dirty * make an introduction attempt. so timestamp_dirty
* will reflect the time since the last attempt. * will reflect the time since the last attempt.
@ -1027,7 +1027,7 @@ link_apconn_to_circ(connection_t *apconn, circuit_t *circ)
} }
/** If an exit wasn't specifically chosen, save the history for future /** If an exit wasn't specifically chosen, save the history for future
* use */ * use. */
static void static void
consider_recording_trackhost(connection_t *conn, circuit_t *circ) consider_recording_trackhost(connection_t *conn, circuit_t *circ)
{ {
@ -1066,6 +1066,7 @@ consider_recording_trackhost(connection_t *conn, circuit_t *circ)
strlen("exit") + 1 /* '\0' */; strlen("exit") + 1 /* '\0' */;
new_address = tor_malloc(len); new_address = tor_malloc(len);
//XXX need to use $key not nickname
tor_snprintf(new_address, len, "%s.%s.exit", tor_snprintf(new_address, len, "%s.%s.exit",
conn->socks_request->address, conn->socks_request->address,
circ->build_state->chosen_exit->nickname); circ->build_state->chosen_exit->nickname);