diff options
author | Roger Dingledine <arma@torproject.org> | 2005-09-13 21:24:51 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2005-09-13 21:24:51 +0000 |
commit | 26cc51ffeab5775273409266c9c40ff396f95b15 (patch) | |
tree | dce2573ad61f63d30b9e4777736797e2a947bcf8 /src/or/circuitbuild.c | |
parent | 890847d232015ccb3242b53a05da5844e55291aa (diff) | |
download | tor-26cc51ffeab5775273409266c9c40ff396f95b15.tar.gz tor-26cc51ffeab5775273409266c9c40ff396f95b15.zip |
a bit more code cleanup
svn:r5033
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 12e34f8ee2..e535d9add1 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -458,6 +458,26 @@ circuit_deliver_create_cell(circuit_t *circ, uint8_t cell_type, char *payload) return 0; } +/** We've decided to start our reachability testing. If all + * is set, log this to the user. Return 1 if we did, or 0 if + * we chose not to log anything. */ +int +inform_testing_reachability(void) +{ + char dirbuf[128]; + routerinfo_t *me = router_get_my_routerinfo(); + if (!me) + return 0; + if (me->dir_port) + tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d", + me->address, me->dir_port); + log(LOG_NOTICE,"Now checking whether ORPort %s:%d%s %s reachable... (this may take several minutes)", + me->address, me->or_port, + me->dir_port ? dirbuf : "", + me->dir_port ? "are" : "is"); + return 1; +} + extern int has_completed_circuit; /** This is the backbone function for building circuits. @@ -531,20 +551,10 @@ circuit_send_next_onion_skin(circuit_t *circ) if (!has_completed_circuit) { or_options_t *options = get_options(); has_completed_circuit=1; - /* XXX009 Log a count of known routers here */ + /* FFFF Log a count of known routers here */ log(LOG_NOTICE,"Tor has successfully opened a circuit. Looks like it's working."); if (server_mode(options) && !check_whether_orport_reachable()) { - char dirbuf[128]; - routerinfo_t *me = router_get_my_routerinfo(); - if (me) { - if (me->dir_port) - tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d", - me->address, me->dir_port); - log(LOG_NOTICE,"Now checking whether ORPort %s:%d%s %s reachable... (this may take several minutes)", - me->address, me->or_port, - me->dir_port ? dirbuf : "", - me->dir_port ? "are" : "is"); - } + inform_testing_reachability(); } } circuit_rep_hist_note_result(circ); |