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

[or-cvs] clean up maxconn hack slightly



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

Modified Files:
      Tag: tor-0_0_9-patches
	config.c main.c or.h 
Log Message:
clean up maxconn hack slightly


Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.286.2.7
retrieving revision 1.286.2.8
diff -u -d -r1.286.2.7 -r1.286.2.8
--- config.c	4 Feb 2005 00:44:03 -0000	1.286.2.7
+++ config.c	4 Feb 2005 00:56:23 -0000	1.286.2.8
@@ -136,7 +136,7 @@
   VAR("LogLevel",            LINELIST_S, OldLogOptions,      NULL),
   VAR("LogFile",             LINELIST_S, OldLogOptions,      NULL),
   OBSOLETE("LinkPadding"),
-  VAR("MaxConn",             UINT,     MaxConn,              "1024"),
+  VAR("MaxConn",             UINT,     _MaxConn,             "1024"),
   VAR("MaxOnionsPending",    UINT,     MaxOnionsPending,     "100"),
   VAR("MonthlyAccountingStart",UINT,   _MonthlyAccountingStart,"0"),
   VAR("AccountingMaxKB",     UINT,     _AccountingMaxKB,     "0"),
@@ -287,24 +287,23 @@
   close_temp_logs();
   add_callback_log(LOG_NOTICE, LOG_ERR, control_event_logmsg);
 
-  if (options->MaxConn < 1) {
-    log(LOG_WARN, "MaxConn option must be a non-zero positive integer.");
-    return -1;
+  if (options->_MaxConn < 1) {
+    options->_MaxConn = 1024;
   }
 
-  if (set_max_file_descriptors(&options->MaxConn) < 0)
+  if (set_max_file_descriptors(&options->_MaxConn) < 0)
     return -1;
 
 #ifdef USE_FAKE_POLL
-  if (options->MaxConn > 1024) {
+  if (options->_MaxConn > 1024) {
     log(LOG_INFO, "Systems without a working poll() can't set MaxConn higher than 1024 in Tor 0.0.9.x. Capping.");
-    options->MaxConn = 1024;
+    options->_MaxConn = 1024;
   }
 #endif
 
-  if (options->MaxConn > MAXCONNECTIONS) {
-    log(LOG_INFO, "MaxConn option must be at most %d. Capping it.", MAXCONNECTIONS);
-    options->MaxConn = MAXCONNECTIONS;
+  if (options->_MaxConn > MAXCONNECTIONS) {
+    log(LOG_INFO, "MaxConn must be at most %d. Capping it.", MAXCONNECTIONS);
+    options->_MaxConn = MAXCONNECTIONS;
   }
 
   {

Index: main.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/main.c,v
retrieving revision 1.407.2.8
retrieving revision 1.407.2.9
diff -u -d -r1.407.2.8 -r1.407.2.9
--- main.c	4 Feb 2005 00:44:04 -0000	1.407.2.8
+++ main.c	4 Feb 2005 00:56:23 -0000	1.407.2.9
@@ -99,7 +99,7 @@
   tor_assert(conn);
   tor_assert(conn->s >= 0);
 
-  if (nfds >= get_options()->MaxConn-1) {
+  if (nfds >= get_options()->_MaxConn-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.508.2.9
retrieving revision 1.508.2.10
diff -u -d -r1.508.2.9 -r1.508.2.10
--- or.h	28 Jan 2005 06:28:43 -0000	1.508.2.9
+++ or.h	4 Feb 2005 00:56:23 -0000	1.508.2.10
@@ -925,7 +925,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 MaxConn; /**< Maximum number of simultaneous connections. */
+  int _MaxConn; /**< 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) */