chiark / gitweb /
do not block reconnections due to us having successfully connected our only connection
authorIan Jackson <ian@liberator.(none)>
Wed, 5 May 2010 20:35:57 +0000 (21:35 +0100)
committerIan Jackson <ian@liberator.(none)>
Wed, 5 May 2010 20:35:57 +0000 (21:35 +0100)
backends/innduct.c

index 772fc89..adf6cad 100644 (file)
@@ -1233,7 +1233,6 @@ static pid_t connecting_child;
 static int connecting_fdpass_sock;
 
 static void connect_attempt_discard(void) {
-  reconnect_blocking_event();
   if (connecting_child) {
     int status= xwaitpid(&connecting_child, "connect");
     if (!(WIFEXITED(status) ||
@@ -1358,6 +1357,7 @@ static void *connchild_event(oop_source *lp, int fd, oop_event e, void *u) {
  x:
   conn_dispose(conn);
   connect_attempt_discard();
+  reconnect_blocking_event();
   return OOP_CONTINUE;
 }
 
@@ -1372,6 +1372,7 @@ static void connect_start(void) {
   assert(!connecting_fdpass_sock);
 
   info("starting connection attempt");
+  int ok_reconnect_delay_periods= reconnect_delay_periods;
   reconnect_blocking_event();
 
   int socks[2];
@@ -1465,6 +1466,9 @@ static void connect_start(void) {
   connecting_fdpass_sock= socks[0];
   xsetnonblock(connecting_fdpass_sock, 1);
   on_fd_read_except(connecting_fdpass_sock, connchild_event);
+
+  if (!conns.count)
+    reconnect_delay_periods= ok_reconnect_delay_periods;
 }
 
 /*---------- assigning articles to conns, and transmitting ----------*/