chiark / gitweb /
break out allow_connect_start
authorIan Jackson <ian@liberator.(none)>
Mon, 26 Apr 2010 09:33:40 +0000 (10:33 +0100)
committerIan Jackson <ian@liberator.(none)>
Mon, 26 Apr 2010 09:33:40 +0000 (10:33 +0100)
backends/innduct.c

index 018d6bc..0e0b0ed 100644 (file)
@@ -738,6 +738,12 @@ static void *connchild_event(oop_source *lp, int fd, oop_event e, void *u) {
   connect_attempt_discard();
 }
 
   connect_attempt_discard();
 }
 
+static int allow_connect_start(void) {
+  return conns.count < max_connections
+    && !connecting_child
+    && !until_connect;
+}
+
 static void connect_start(void) {
   assert(!connecting_sockets[0]);
   assert(!connecting_sockets[1]);
 static void connect_start(void) {
   assert(!connecting_sockets[0]);
   assert(!connecting_sockets[1]);
@@ -861,8 +867,7 @@ static void check_master_queue(void) {
        spare--;
       }
       conn_maybe_write(use);
        spare--;
       }
       conn_maybe_write(use);
-    } else if (conns.count < max_connections &&
-            !connecting_child && !until_connect) {
+    } else if (allow_connect_start()) {
       until_connect= reconnect_delay_periods;
       connect_start();
       break;
       until_connect= reconnect_delay_periods;
       connect_start();
       break;