[or-cvs] add geoff"s NoPublish patch

Roger Dingledine arma at seul.org
Thu Apr 21 10:40:50 UTC 2005


Update of /home2/or/cvsroot/tor/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/tor/src/or

Modified Files:
	config.c or.h router.c 
Log Message:
add geoff's NoPublish patch


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.333
retrieving revision 1.334
diff -u -d -r1.333 -r1.334
--- config.c	6 Apr 2005 19:07:38 -0000	1.333
+++ config.c	21 Apr 2005 10:40:47 -0000	1.334
@@ -128,6 +128,7 @@
   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 @@
     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);

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.593
retrieving revision 1.594
diff -u -d -r1.593 -r1.594
--- or.h	8 Apr 2005 03:36:39 -0000	1.593
+++ or.h	21 Apr 2005 10:40:47 -0000	1.594
@@ -1010,6 +1010,7 @@
   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

Index: router.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/router.c,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- router.c	2 Apr 2005 08:55:31 -0000	1.167
+++ router.c	21 Apr 2005 10:40:48 -0000	1.168
@@ -472,18 +472,23 @@
   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)



More information about the tor-commits mailing list