[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Forward-port the trick to bump up ConnLimit as far as it can



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 main.c or.h 
Log Message:
Forward-port the trick to bump up ConnLimit as far as it can
go, but not past MAXCONNECTIONS. Also throw away the FAKE_POLL
caveats since 0.1.0 doesn't need it any more.


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.315
retrieving revision 1.316
diff -u -d -r1.315 -r1.316
--- config.c	22 Feb 2005 08:18:35 -0000	1.315
+++ config.c	22 Feb 2005 23:52:44 -0000	1.316
@@ -64,6 +64,7 @@
   { "BandwidthRateBytes", "BandwidthRate", 0},
   { "BandwidthBurstBytes", "BandwidthBurst", 0},
   { "DirFetchPostPeriod", "StatusFetchPeriod", 0},
+  { "MaxConn", "ConnLimit", 0},
   { NULL, NULL , 0},
 };
 #undef PLURAL
@@ -141,7 +142,7 @@
   VAR("LogLevel",            LINELIST_S, OldLogOptions,      NULL),
   VAR("LogFile",             LINELIST_S, OldLogOptions,      NULL),
   OBSOLETE("LinkPadding"),
-  VAR("MaxConn",             UINT,     MaxConn,              "1024"),
+  VAR("ConnLimit",           UINT,     ConnLimit,            "1024"),
   VAR("MaxOnionsPending",    UINT,     MaxOnionsPending,     "100"),
   VAR("MonthlyAccountingStart",UINT,   _MonthlyAccountingStart,"0"),
   VAR("AccountingMaxKB",     UINT,     _AccountingMaxKB,     "0"),
@@ -312,7 +313,9 @@
   close_temp_logs();
   add_callback_log(LOG_NOTICE, LOG_ERR, control_event_logmsg);
 
-  if (set_max_file_descriptors(options->MaxConn) < 0)
+  options->_ConnLimit =
+    set_max_file_descriptors(options->ConnLimit, MAXCONNECTIONS);
+  if (options->_ConnLimit < 0)
     return -1;
 
   {
@@ -1345,16 +1348,6 @@
     result = -1;
   }
 
-  if (options->MaxConn < 1) {
-    log(LOG_WARN, "MaxConn option must be a non-zero positive integer.");
-    result = -1;
-  }
-
-  if (options->MaxConn > MAXCONNECTIONS) {
-    log(LOG_WARN, "MaxConn option must be at most %d.", MAXCONNECTIONS);
-    result = -1;
-  }
-
 #define MIN_DIR_FETCH_PERIOD 600
 #define MIN_DIR_POST_PERIOD 300
 #define MIN_REND_POST_PERIOD 300

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.448
retrieving revision 1.449
diff -u -d -r1.448 -r1.449
--- main.c	22 Feb 2005 02:57:43 -0000	1.448
+++ main.c	22 Feb 2005 23:52:44 -0000	1.449
@@ -118,8 +118,8 @@
   tor_assert(conn);
   tor_assert(conn->s >= 0);
 
-  if (nfds >= get_options()->MaxConn-1) {
-    log_fn(LOG_WARN,"Failing because we have %d connections already. Please set MaxConn higher.", nfds);
+  if (nfds >= get_options()->_ConnLimit-1) {
+    log_fn(LOG_WARN,"Failing because we have %d connections already. Please raise your ulimit -n.", nfds);
     return -1;
   }
 

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.537
retrieving revision 1.538
diff -u -d -r1.537 -r1.538
--- or.h	22 Feb 2005 04:26:45 -0000	1.537
+++ or.h	22 Feb 2005 23:52:44 -0000	1.538
@@ -948,7 +948,8 @@
   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 MaxConn; /**< Maximum number of simultaneous connections. */
+  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
                       * directory recommends. */
   int RunAsDaemon; /**< If true, run in the background. (Unix only) */