[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] a bit more code cleanup
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
circuitbuild.c hibernate.c
Log Message:
a bit more code cleanup
Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- circuitbuild.c 10 Sep 2005 01:01:40 -0000 1.141
+++ circuitbuild.c 13 Sep 2005 21:24:51 -0000 1.142
@@ -458,6 +458,26 @@
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 @@
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);
Index: hibernate.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/hibernate.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- hibernate.c 8 Aug 2005 21:59:48 -0000 1.59
+++ hibernate.c 13 Sep 2005 21:24:51 -0000 1.60
@@ -413,10 +413,10 @@
}
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);
}
}