From ef6c9d18e799e5b02505ba73bbf36bfe92ce5a8b Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Sun, 5 Dec 2004 07:10:08 +0000 Subject: New circuit building strategy: keep a list of ports that we've used in the past 6 hours, and always try to have 2 circuits open or on the way that will handle each such port. (We can extend this to include addresses if exit policies shift to require that.) Seed us with port 80 so web browsers won't complain that Tor is "slow to start up". This was necessary because our old circuit building strategy just involved counting circuits, and as time went by we would build up a big pile of circuits that had peculiar exit policies (e.g. only exit to 9001-9100) which would take up space in the circuit pile but never get used. Fix router_compare_addr_to_addr_policy: it was not treating a port of * as always matching, so we were picking reject *:* nodes as exit nodes too. If you haven't used a clean circuit in an hour, throw it away, just to be on the safe side. This means after 6 hours a totally unused Tor client will have no circuits open. svn:r3078 --- src/or/connection_edge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/or/connection_edge.c') diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 1ef8242f5..f25719a98 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -405,6 +405,7 @@ static int connection_ap_handshake_process_socks(connection_t *conn) { return -1; } conn->state = AP_CONN_STATE_CIRCUIT_WAIT; + rep_hist_note_used_port(socks->port, time(NULL)); /* help predict this next time */ return connection_ap_handshake_attach_circuit(conn); } else { /* it's a hidden-service request */ @@ -1016,7 +1017,7 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit) } else { addr = client_dns_lookup_entry(conn->socks_request->address); if (router_compare_addr_to_addr_policy(addr, conn->socks_request->port, - exit->exit_policy) < 0) + exit->exit_policy) == ADDR_POLICY_REJECTED) return 0; } return 1; -- cgit v1.2.3