summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2005-04-21 10:40:48 +0000
committerRoger Dingledine <arma@torproject.org>2005-04-21 10:40:48 +0000
commitad4eca60ec0839abdaff69a0a896436cbd5b30d6 (patch)
treedb094175717f41141a6c02f2117ba62ff8b08448
parentd2795a6ed34b65f84a5b0e70795d4c8b3e55fe43 (diff)
downloadtor-ad4eca60ec0839abdaff69a0a896436cbd5b30d6.tar.gz
tor-ad4eca60ec0839abdaff69a0a896436cbd5b30d6.zip
add geoff's NoPublish patch
svn:r4084
-rw-r--r--src/or/config.c6
-rw-r--r--src/or/or.h1
-rw-r--r--src/or/router.c15
3 files changed, 17 insertions, 5 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 1d03146cf1..48f08e5b5f 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -128,6 +128,7 @@ static config_var_t config_vars[] = {
VAR("FirewallPorts", CSV, FirewallPorts, "80,443"),
VAR("MyFamily", STRING, MyFamily, NULL),
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
+ VAR("NoPublish", BOOL, NoPublish, "0"),
VAR("Group", STRING, Group, NULL),
VAR("HashedControlPassword",STRING, HashedControlPassword, NULL),
VAR("HttpProxy", STRING, HttpProxy, NULL),
@@ -1330,6 +1331,11 @@ options_validate(or_options_t *options)
result = -1;
}
+ if (options->AuthoritativeDir && options->NoPublish) {
+ log(LOG_WARN, "You cannot set both AuthoritativeDir and NoPublish.");
+ result = -1;
+ }
+
if (options->ConnLimit <= 0) {
log(LOG_WARN, "ConnLimit must be greater than 0, but was set to %d",
options->ConnLimit);
diff --git a/src/or/or.h b/src/or/or.h
index 853025e425..232eeb5960 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1010,6 +1010,7 @@ typedef struct {
int DirPort; /**< Port to listen on for directory connections. */
int AuthoritativeDir; /**< Boolean: is this an authoritative directory? */
int ClientOnly; /**< Boolean: should we never evolve into a server role? */
+ int NoPublish; /**< Boolean: should we never publish a descriptor? */
int ConnLimit; /**< Requested maximum number of simultaneous connections. */
int _ConnLimit; /**< Actual maximum number of simultaneous connections. */
int IgnoreVersion; /**< If true, run no matter what versions of Tor the
diff --git a/src/or/router.c b/src/or/router.c
index 5c3b416245..dc61dea58f 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -472,18 +472,23 @@ int proxy_mode(or_options_t *options) {
return (options->SocksPort != 0 || options->SocksBindAddress);
}
-/** Decide if we're a publishable server or just a client. We are a server if:
+/** Decide if we're a publishable server. We are a publishable server if:
+ * - We don't have the ClientOnly option set
+ * and
+ * - We don't have the NoPublish option set
+ * and
+ * - We have ORPort set
+ * and
+ * - We believe we are reachable from the outside; or
* - We have the AuthoritativeDirectory option set.
- * or
- * - We don't have the ClientOnly option set; and
- * - We have ORPort set; and
- * - We believe we are reachable from the outside.
*/
static int decide_if_publishable_server(time_t now) {
or_options_t *options = get_options();
if (options->ClientOnly)
return 0;
+ if (options->NoPublish)
+ return 0;
if (!server_mode(options))
return 0;
if (options->AuthoritativeDir)