mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
we were counting incorrectly when trying to figure out whether
a given AP stream was being handled or not. (how did this work?) svn:r2077
This commit is contained in:
parent
30d6b1479b
commit
ddb6eb35af
@ -855,17 +855,13 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
|
|||||||
carray[j]->marked_for_close ||
|
carray[j]->marked_for_close ||
|
||||||
circuit_stream_is_being_handled(carray[j]))
|
circuit_stream_is_being_handled(carray[j]))
|
||||||
continue; /* Skip everything but APs in CIRCUIT_WAIT */
|
continue; /* Skip everything but APs in CIRCUIT_WAIT */
|
||||||
switch (connection_ap_can_use_exit(carray[j], router))
|
if(connection_ap_can_use_exit(carray[j], router)) {
|
||||||
{
|
|
||||||
case ADDR_POLICY_REJECTED:
|
|
||||||
log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
|
|
||||||
router->nickname, i);
|
|
||||||
break; /* would be rejected; try next connection */
|
|
||||||
case ADDR_POLICY_ACCEPTED:
|
|
||||||
case ADDR_POLICY_UNKNOWN:
|
|
||||||
++n_supported[i];
|
++n_supported[i];
|
||||||
log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
|
log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
|
||||||
router->nickname, i, n_supported[i]);
|
router->nickname, i, n_supported[i]);
|
||||||
|
} else {
|
||||||
|
log_fn(LOG_DEBUG,"%s (index %d) would reject this stream.",
|
||||||
|
router->nickname, i);
|
||||||
}
|
}
|
||||||
} /* End looping over connections. */
|
} /* End looping over connections. */
|
||||||
if (n_supported[i] > best_support) {
|
if (n_supported[i] > best_support) {
|
||||||
|
@ -82,7 +82,7 @@ static int circuit_is_acceptable(circuit_t *circ,
|
|||||||
if (!strncmp(exitrouter->platform, "Tor 0.0.7", 9))
|
if (!strncmp(exitrouter->platform, "Tor 0.0.7", 9))
|
||||||
return 0;
|
return 0;
|
||||||
} else if(purpose == CIRCUIT_PURPOSE_C_GENERAL) {
|
} else if(purpose == CIRCUIT_PURPOSE_C_GENERAL) {
|
||||||
if(connection_ap_can_use_exit(conn, exitrouter) == ADDR_POLICY_REJECTED) {
|
if(!connection_ap_can_use_exit(conn, exitrouter)) {
|
||||||
/* can't exit from this router */
|
/* can't exit from this router */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -268,7 +268,7 @@ int circuit_stream_is_being_handled(connection_t *conn) {
|
|||||||
(!circ->timestamp_dirty ||
|
(!circ->timestamp_dirty ||
|
||||||
circ->timestamp_dirty + options.NewCircuitPeriod < now)) {
|
circ->timestamp_dirty + options.NewCircuitPeriod < now)) {
|
||||||
exitrouter = router_get_by_digest(circ->build_state->chosen_exit_digest);
|
exitrouter = router_get_by_digest(circ->build_state->chosen_exit_digest);
|
||||||
if(exitrouter && connection_ap_can_use_exit(conn, exitrouter) != ADDR_POLICY_REJECTED)
|
if(exitrouter && connection_ap_can_use_exit(conn, exitrouter))
|
||||||
if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
|
if(++num >= MIN_CIRCUITS_HANDLING_STREAM)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -945,8 +945,10 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit)
|
|||||||
return strncmp(exit->platform, "Tor 0.0.7", 9) ? 1 : 0;
|
return strncmp(exit->platform, "Tor 0.0.7", 9) ? 1 : 0;
|
||||||
}
|
}
|
||||||
addr = client_dns_lookup_entry(conn->socks_request->address);
|
addr = client_dns_lookup_entry(conn->socks_request->address);
|
||||||
return router_compare_addr_to_exit_policy(addr,
|
if(router_compare_addr_to_exit_policy(addr,
|
||||||
conn->socks_request->port, exit->exit_policy);
|
conn->socks_request->port, exit->exit_policy) < 0)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A helper function for socks_policy_permits_address() below.
|
/** A helper function for socks_policy_permits_address() below.
|
||||||
|
Loading…
Reference in New Issue
Block a user