diff options
author | Roger Dingledine <arma@torproject.org> | 2004-12-05 07:10:08 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-12-05 07:10:08 +0000 |
commit | ef6c9d18e799e5b02505ba73bbf36bfe92ce5a8b (patch) | |
tree | 24e864902bc7196fb3e2ca1a39fc7463c2582d1c /src/or/or.h | |
parent | 32e74d352500dc228a1de5d5bc97e219897ef09b (diff) | |
download | tor-ef6c9d18e799e5b02505ba73bbf36bfe92ce5a8b.tar.gz tor-ef6c9d18e799e5b02505ba73bbf36bfe92ce5a8b.zip |
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
Diffstat (limited to 'src/or/or.h')
-rw-r--r-- | src/or/or.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/or/or.h b/src/or/or.h index a2fb27a75b..85d7d54dfc 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1048,6 +1048,7 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse); int circuit_finish_handshake(circuit_t *circ, char *reply); int circuit_truncated(circuit_t *circ, crypt_path_t *layer); int onionskin_answer(circuit_t *circ, unsigned char *payload, unsigned char *keys); +int circuit_all_predicted_ports_handled(time_t now); void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop); /********************************* circuitlist.c ***********************/ @@ -1082,7 +1083,8 @@ void assert_circuit_ok(const circuit_t *c); /********************************* circuituse.c ************************/ void circuit_expire_building(time_t now); -int circuit_stream_is_being_handled(connection_t *conn); +void circuit_remove_handled_ports(smartlist_t *needed_ports); +int circuit_stream_is_being_handled(connection_t *conn, uint16_t port, int min); void circuit_build_needed_circs(time_t now); void circuit_detach_stream(circuit_t *circ, connection_t *conn); void circuit_about_to_close_connection(connection_t *conn); @@ -1447,6 +1449,8 @@ void rep_hist_note_bytes_written(int num_bytes, time_t when); int rep_hist_bandwidth_assess(void); char *rep_hist_get_bandwidth_lines(void); void rep_history_clean(time_t before); +void rep_hist_note_used_port(uint16_t port, time_t now); +char *rep_hist_get_predicted_ports(time_t now); /********************************* rendclient.c ***************************/ |