summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-09-13 21:24:51 +0000
committerRoger Dingledine <arma@torproject.org>2005-09-13 21:24:51 +0000
commit26cc51ffeab5775273409266c9c40ff396f95b15 (patch)
treedce2573ad61f63d30b9e4777736797e2a947bcf8
parent890847d232015ccb3242b53a05da5844e55291aa (diff)
downloadtor-26cc51ffeab5775273409266c9c40ff396f95b15.tar.gz
tor-26cc51ffeab5775273409266c9c40ff396f95b15.zip
a bit more code cleanup
svn:r5033
-rw-r--r--src/or/circuitbuild.c34
-rw-r--r--src/or/hibernate.c8
2 files changed, 26 insertions, 16 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);
diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index db9c108131..cf7cacc3f4 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -413,10 +413,10 @@ accounting_run_housekeeping(time_t now)
}
if (time_to_record_bandwidth_usage(now)) {
if (accounting_record_bandwidth_usage(now)) {
- log_fn(LOG_ERR, "Couldn't record bandwidth usage; exiting.");
- /* XXX this can fail when you're out of fd's, causing a crash.
- * Perhaps the better answer is to hold the file open all the
- * time? */
+ log_fn(LOG_ERR, "Couldn't record bandwidth usage to disk; exiting.");
+ /* This can fail when we're out of fd's, causing a crash.
+ * The current answer is to reserve 32 more than we need, in
+ * set_max_file_descriptors(). */
exit(1);
}
}