net.connect: Track last connection error
authorMatthew Wild <mwild1@gmail.com>
Mon, 26 Feb 2018 15:20:35 +0000
changeset 8549 d66916dc318a
parent 8548 248bab2bd0c9
child 8550 5e9c87376891
net.connect: Track last connection error
net/connect.lua
--- a/net/connect.lua	Sun Feb 25 11:20:56 2018 +0100
+++ b/net/connect.lua	Mon Feb 26 15:20:35 2018 +0000
@@ -56,7 +56,8 @@
 		log("warn", "Failed connection, but unexpected!");
 		return;
 	end
-	p:log("debug", "Connection attempt failed");
+	p.last_error = reason or "unknown reason";
+	p:log("debug", "Connection attempt failed: %s", p.last_error);
 	attempt_connection(p);
 end