summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2018-03-25 21:55:34 +0200
committerAlexander Barton <alex@barton.de>2018-03-25 21:59:01 +0200
commitb4f7aae67e1ab3be8f01c27190316683fbe9f0d8 (patch)
tree4ef82bab2b31e7afd532dfb07437907d8d6e7d98 /src
parent798de94d6556bdf2c6019f368ad7441fe6e2d1be (diff)
downloadngircd-b4f7aae67e1ab3be8f01c27190316683fbe9f0d8.tar.gz
ngircd-b4f7aae67e1ab3be8f01c27190316683fbe9f0d8.zip
Correctly retry outgoing conenctions when forking a resolver failed
When ngIRCd failed to spawn a new resolver subprocess, the connection
structure was still marked as "SERVER_WAIT", and no new attempt to
connect to this server was made.

Thanks to Robert Obermeier for reporting this bug!

Closes #243.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/conn.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 16cf13cf..5505e646 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2018 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1918,8 +1918,11 @@ Check_Servers(void)
 		Conf_Server[i].lasttry = time_now;
 		Conf_Server[i].conn_id = SERVER_WAIT;
 		assert(Proc_GetPipeFd(&Conf_Server[i].res_stat) < 0);
-		Resolve_Name(&Conf_Server[i].res_stat, Conf_Server[i].host,
-			     cb_Connect_to_Server);
+
+		/* Start resolver subprocess ... */
+		if (!Resolve_Name(&Conf_Server[i].res_stat, Conf_Server[i].host,
+				  cb_Connect_to_Server))
+			Conf_Server[i].conn_id = NONE;
 	}
 } /* Check_Servers */