aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-01-25 19:41:15 +0000
committerRoger Dingledine <arma@torproject.org>2007-01-25 19:41:15 +0000
commit9d5449c52e666924e75a6365e5e86411ce364d28 (patch)
tree4674b84c19a2b8da1e501abdc66d8be7447fe16b
parent75db2a61cb1396cf2ae52b36345fc16784d70ead (diff)
downloadtor-9d5449c52e666924e75a6365e5e86411ce364d28.tar
tor-9d5449c52e666924e75a6365e5e86411ce364d28.tar.gz
Inform the server operator when we decide not to advertise a
DirPort due to AccountingMax enabled or a low BandwidthRate. It was confusing Zax, so now we're hopefully more helpful. svn:r9404
-rw-r--r--ChangeLog3
-rw-r--r--src/or/router.c47
2 files changed, 41 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 60edcd739..723ded7f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,9 @@ Changes in version 0.1.2.7-alpha - 2007-??-??
this by setting ServerDNSAllowNonRFC953Addresses to 1.
- Adapt a patch from goodell to let the contrib/exitlist script
take arguments rather than require direct editing.
+ - Inform the server operator when we decide not to advertise a
+ DirPort due to AccountingMax enabled or a low BandwidthRate. It
+ was confusing Zax, so now we're hopefully more helpful.
o Minor features (controller):
- Track reasons for OR connection failure; make these reasons available
diff --git a/src/or/router.c b/src/or/router.c
index 2a3674969..2d08b1d8c 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -410,10 +410,22 @@ check_whether_dirport_reachable(void)
/** Look at a variety of factors, and return 0 if we don't want to
* advertise the fact that we have a DirPort open. Else return the
- * DirPort we want to advertise. */
+ * DirPort we want to advertise.
+ *
+ * Log a helpful message if we change our mind about whether to publish
+ * a DirPort.
+ */
static int
decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router)
{
+ static int advertising=1; /* start out assuming we will advertise */
+ int new_choice=1;
+ const char *reason = NULL;
+
+ /* Section one: reasons to publish or not publish that aren't
+ * worth mentioning to the user, either because they're obvious
+ * or because they're normal behavior. */
+
if (!router->dir_port) /* short circuit the rest of the function */
return 0;
if (authdir_mode(options)) /* always publish */
@@ -422,15 +434,32 @@ decide_to_advertise_dirport(or_options_t *options, routerinfo_t *router)
return 0;
if (!check_whether_dirport_reachable())
return 0;
- /* check if we might potentially hibernate. */
- if (accounting_is_enabled(options))
- return 0;
- /* also check if we're advertising a small amount */
- if (router->bandwidthrate <= 51200)
- return 0;
- /* Sounds like a great idea. Let's publish it. */
- return router->dir_port;
+ /* Section two: reasons to publish or not publish that the user
+ * might find surprising. These are generally config options that
+ * make us choose not to publish. */
+
+ if (accounting_is_enabled(options)) {
+ /* if we might potentially hibernate */
+ new_choice = 0;
+ reason = "AccountingMax enabled";
+ } else if (router->bandwidthrate <= 51200) {
+ /* if we're advertising a small amount */
+ new_choice = 0;
+ reason = "BandwidthRate under 50KB";
+ }
+
+ if (advertising != new_choice) {
+ if (new_choice == 1) {
+ log(LOG_NOTICE, LD_DIR, "Advertising DirPort as %d", router->dir_port);
+ } else {
+ tor_assert(reason);
+ log(LOG_NOTICE, LD_DIR, "Not advertising DirPort (Reason: %s)", reason);
+ }
+ advertising = new_choice;
+ }
+
+ return advertising ? router->dir_port : 0;
}
/** Some time has passed, or we just got new directory information.