net.connect: Improve logging on connection attempt failure
authorMatthew Wild <mwild1@gmail.com>
Mon, 21 Mar 2022 11:15:30 +0000
changeset 12430 7a3da1acace1
parent 12429 eabcc3ae22e9
child 12432 ba5bf1d9d9bd
net.connect: Improve logging on connection attempt failure
net/connect.lua
--- a/net/connect.lua	Mon Mar 21 11:01:58 2022 +0000
+++ b/net/connect.lua	Mon Mar 21 11:15:30 2022 +0000
@@ -93,9 +93,13 @@
 	p.conns[conn] = nil;
 	p.last_error = reason or "unknown reason";
 	p:log("debug", "Connection attempt failed: %s", p.last_error);
-	if next(p.conns) == nil and not p.connected then
+	if p.connected then
+		p:log("debug", "Connection already established, ignoring failure");
+	elseif next(p.conns) == nil then
 		p:log("debug", "No pending connection attempts, and not yet connected");
 		attempt_connection(p);
+	else
+		p:log("debug", "Other attempts are still pending, ignoring failure");
 	end
 end