mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
prune abandoned circs better
add debugging info for the bug weasel found svn:r1626
This commit is contained in:
parent
37255d24bc
commit
b51561f7fb
@ -474,11 +474,15 @@ void circuit_expire_building(time_t now) {
|
|||||||
* 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 ||
|
||||||
victim->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND ||
|
victim->purpose == CIRCUIT_PURPOSE_C_ESTABLISH_REND ||
|
||||||
|
victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCING ||
|
||||||
victim->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO ||
|
victim->purpose == CIRCUIT_PURPOSE_S_ESTABLISH_INTRO ||
|
||||||
|
|
||||||
/* c_rend_ready circs measure age since timestamp_dirty,
|
/* c_rend_ready circs measure age since timestamp_dirty,
|
||||||
* because that's set when they switch purposes
|
* because that's set when they switch purposes
|
||||||
*/
|
*/
|
||||||
(victim->purpose == CIRCUIT_PURPOSE_C_REND_READY &&
|
((victim->purpose == CIRCUIT_PURPOSE_C_REND_READY ||
|
||||||
|
victim->purpose == CIRCUIT_PURPOSE_C_REND_READY_INTRO_ACKED ||
|
||||||
|
victim->purpose == CIRCUIT_PURPOSE_C_INTRODUCE_ACK_WAIT) &&
|
||||||
victim->timestamp_dirty + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)) {
|
victim->timestamp_dirty + MIN_SECONDS_BEFORE_EXPIRING_CIRC > now)) {
|
||||||
if(victim->n_conn)
|
if(victim->n_conn)
|
||||||
log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s)",
|
log_fn(LOG_INFO,"Abandoning circ %s:%d:%d (state %d:%s)",
|
||||||
|
@ -1150,19 +1150,24 @@ static int connection_exit_begin_conn(cell_t *cell, circuit_t *circ) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_fn(LOG_DEBUG,"finished adding conn");
|
||||||
|
|
||||||
/* add it into the linked list of streams on this circuit */
|
/* add it into the linked list of streams on this circuit */
|
||||||
n_stream->next_stream = circ->n_streams;
|
n_stream->next_stream = circ->n_streams;
|
||||||
circ->n_streams = n_stream;
|
circ->n_streams = n_stream;
|
||||||
|
|
||||||
if(circ->purpose == CIRCUIT_PURPOSE_S_REND_JOINED) {
|
if(circ->purpose == CIRCUIT_PURPOSE_S_REND_JOINED) {
|
||||||
|
log_fn(LOG_DEBUG,"begin is for rendezvous. configuring stream.");
|
||||||
n_stream->address = tor_strdup("(rendezvous)");
|
n_stream->address = tor_strdup("(rendezvous)");
|
||||||
n_stream->state = EXIT_CONN_STATE_CONNECTING;
|
n_stream->state = EXIT_CONN_STATE_CONNECTING;
|
||||||
strcpy(n_stream->rend_query, circ->rend_query);
|
strcpy(n_stream->rend_query, circ->rend_query);
|
||||||
|
assert(n_stream->rend_query[0]);
|
||||||
if(rend_service_set_connection_addr_port(n_stream, circ) < 0) {
|
if(rend_service_set_connection_addr_port(n_stream, circ) < 0) {
|
||||||
log_fn(LOG_WARN,"Didn't find rendezvous service (port %d)",n_stream->port);
|
log_fn(LOG_WARN,"Didn't find rendezvous service (port %d)",n_stream->port);
|
||||||
connection_mark_for_close(n_stream,0 /* XXX */);
|
connection_mark_for_close(n_stream,0 /* XXX */);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
log_fn(LOG_DEBUG,"Finished assigning addr/port");
|
||||||
n_stream->cpath_layer = circ->cpath->prev; /* link it */
|
n_stream->cpath_layer = circ->cpath->prev; /* link it */
|
||||||
connection_exit_connect(n_stream);
|
connection_exit_connect(n_stream);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1196,6 +1201,7 @@ void connection_exit_connect(connection_t *conn) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_fn(LOG_DEBUG,"about to try connecting");
|
||||||
switch(connection_connect(conn, conn->address, conn->addr, conn->port)) {
|
switch(connection_connect(conn, conn->address, conn->addr, conn->port)) {
|
||||||
case -1:
|
case -1:
|
||||||
connection_mark_for_close(conn, END_STREAM_REASON_CONNECTFAILED);
|
connection_mark_for_close(conn, END_STREAM_REASON_CONNECTFAILED);
|
||||||
|
@ -884,6 +884,7 @@ rend_service_set_connection_addr_port(connection_t *conn, circuit_t *circ)
|
|||||||
char serviceid[REND_SERVICE_ID_LEN];
|
char serviceid[REND_SERVICE_ID_LEN];
|
||||||
|
|
||||||
assert(circ->purpose == CIRCUIT_PURPOSE_S_REND_JOINED);
|
assert(circ->purpose == CIRCUIT_PURPOSE_S_REND_JOINED);
|
||||||
|
log_fn(LOG_DEBUG,"beginning to hunt for addr/port");
|
||||||
if (base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
|
if (base32_encode(serviceid, REND_SERVICE_ID_LEN+1,
|
||||||
circ->rend_pk_digest,10)) {
|
circ->rend_pk_digest,10)) {
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user