s2smanager: Handle DNS lookup error in response handler

Fri, 24 Dec 2010 04:57:17 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Fri, 24 Dec 2010 04:57:17 +0000
changeset 3959
32a2a4f522f8
parent 3958
8bd0b2d4b9b0
child 3960
bb8a064883fc

s2smanager: Handle DNS lookup error in response handler

core/s2smanager.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Fri Dec 24 04:56:37 2010 +0000
+++ b/core/s2smanager.lua	Fri Dec 24 04:57:17 2010 +0000
@@ -288,7 +288,7 @@
 function try_connect(host_session, connect_host, connect_port)
 	host_session.connecting = true;
 	local handle;
-	handle = adns.lookup(function (reply)
+	handle = adns.lookup(function (reply, err)
 		handle = nil;
 		host_session.connecting = nil;
 		
@@ -311,7 +311,8 @@
 			log("debug", "DNS lookup failed to get a response for %s", connect_host);
 			if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can
 				log("debug", "No other records to try for %s - destroying", host_session.to_host);
-				destroy_session(host_session, "DNS resolution failed"); -- End of the line, we can't
+				err = err and (": "..err) or "";
+				destroy_session(host_session, "DNS resolution failed"..err); -- End of the line, we can't
 			end
 		end
 	end, connect_host, "A", "IN");

mercurial