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

[or-cvs] r10486: Remove force flag from retry_all_listeners() and retry_liste (tor/trunk/src/or)



Author: weasel
Date: 2007-06-04 12:54:42 -0400 (Mon, 04 Jun 2007)
New Revision: 10486

Modified:
   tor/trunk/src/or/config.c
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/main.c
   tor/trunk/src/or/or.h
Log:
Remove force flag from retry_all_listeners() and retry_listeners().  It always was 0.

Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c	2007-06-04 15:30:40 UTC (rev 10485)
+++ tor/trunk/src/or/config.c	2007-06-04 16:54:42 UTC (rev 10486)
@@ -830,7 +830,7 @@
 
     /* Launch the listeners.  (We do this before we setuid, so we can bind to
      * ports under 1024.) */
-    if (retry_all_listeners(0, replaced_listeners, new_listeners) < 0) {
+    if (retry_all_listeners(replaced_listeners, new_listeners) < 0) {
       *msg = tor_strdup("Failed to bind one of the listener ports.");
       goto rollback;
     }

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2007-06-04 15:30:40 UTC (rev 10485)
+++ tor/trunk/src/or/connection.c	2007-06-04 16:54:42 UTC (rev 10486)
@@ -995,17 +995,16 @@
  * connection binding to each one.  Otherwise, create a single
  * connection binding to the address <b>default_addr</b>.)
  *
- * If <b>force</b> is true, close and re-open all listener connections.
- * Otherwise, only relaunch the listeners of this type if the number of
- * existing connections is not as configured (e.g., because one died),
- * or if the existing connections do not match those configured.
+ * Only relaunch the listeners of this type if the number of existing
+ * connections is not as configured (e.g., because one died), or if the
+ * existing connections do not match those configured.
  *
  * Add all old conns that should be closed to <b>replaced_conns</b>.
  * Add all new connections to <b>new_conns</b>.
  */
 static int
 retry_listeners(int type, config_line_t *cfg,
-                int port_option, const char *default_addr, int force,
+                int port_option, const char *default_addr,
                 smartlist_t *replaced_conns,
                 smartlist_t *new_conns,
                 int never_open_conns)
@@ -1039,15 +1038,6 @@
   {
     if (conn->type != type || conn->marked_for_close)
       continue;
-    if (force) {
-      /* It's a listener, and we're relaunching all listeners of this
-       * type. Close this one. */
-      log_notice(LD_NET, "Force-closing listener %s on %s:%d",
-             conn_type_to_string(type), conn->address, conn->port);
-      connection_close_immediate(conn);
-      connection_mark_for_close(conn);
-      continue;
-    }
     /* Okay, so this is a listener.  Is it configured? */
     line = NULL;
     SMARTLIST_FOREACH(launch, config_line_t *, wanted,
@@ -1110,47 +1100,45 @@
   return r;
 }
 
-/** (Re)launch listeners for each port you should have open.  If
- * <b>force</b> is true, close and relaunch all listeners. If <b>force</b>
- * is false, then only relaunch listeners when we have the wrong number of
- * connections for a given type.
+/** (Re)launch listeners for each port you should have open.  Only relaunch
+ * listeners when we have the wrong number of connections for a given type.
  *
  * Add all old conns that should be closed to <b>replaced_conns</b>.
  * Add all new connections to <b>new_conns</b>.
  */
 int
-retry_all_listeners(int force, smartlist_t *replaced_conns,
+retry_all_listeners(smartlist_t *replaced_conns,
                     smartlist_t *new_conns)
 {
   or_options_t *options = get_options();
 
   if (retry_listeners(CONN_TYPE_OR_LISTENER, options->ORListenAddress,
-                      options->ORPort, "0.0.0.0", force,
+                      options->ORPort, "0.0.0.0",
                       replaced_conns, new_conns, options->ClientOnly)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_DIR_LISTENER, options->DirListenAddress,
-                      options->DirPort, "0.0.0.0", force,
+                      options->DirPort, "0.0.0.0",
                       replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_AP_LISTENER, options->SocksListenAddress,
-                      options->SocksPort, "127.0.0.1", force,
+                      options->SocksPort, "127.0.0.1",
                       replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_AP_TRANS_LISTENER, options->TransListenAddress,
-                      options->TransPort, "127.0.0.1", force,
+                      options->TransPort, "127.0.0.1",
                       replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_AP_NATD_LISTENER, options->NatdListenAddress,
-                      options->NatdPort, "127.0.0.1", force,
+                      options->NatdPort, "127.0.0.1",
                       replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_AP_DNS_LISTENER, options->DNSListenAddress,
-                      options->DNSPort, "127.0.0.1", force,
+                      options->DNSPort, "127.0.0.1",
                       replaced_conns, new_conns, 0)<0)
     return -1;
   if (retry_listeners(CONN_TYPE_CONTROL_LISTENER,
                       options->ControlListenAddress,
-                      options->ControlPort, "127.0.0.1", force,
+                      options->ControlPort, "127.0.0.1",
                       replaced_conns, new_conns, 0)<0)
     return -1;
 

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-06-04 15:30:40 UTC (rev 10485)
+++ tor/trunk/src/or/main.c	2007-06-04 16:54:42 UTC (rev 10486)
@@ -1012,7 +1012,7 @@
   /** 3d. And every 60 seconds, we relaunch listeners if any died. */
   if (!we_are_hibernating() && time_to_check_listeners < now) {
     /* 0 means "only launch the ones that died." */
-    retry_all_listeners(0, NULL, NULL);
+    retry_all_listeners(NULL, NULL);
     time_to_check_listeners = now+60;
   }
 

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2007-06-04 15:30:40 UTC (rev 10485)
+++ tor/trunk/src/or/or.h	2007-06-04 16:54:42 UTC (rev 10486)
@@ -2341,7 +2341,7 @@
 
 int connection_connect(connection_t *conn, const char *address, uint32_t addr,
                        uint16_t port);
-int retry_all_listeners(int force, smartlist_t *replaced_conns,
+int retry_all_listeners(smartlist_t *replaced_conns,
                         smartlist_t *new_conns);
 
 int connection_bucket_write_limit(connection_t *conn);