Mercurial > prosody-hg
comparison net/connect.lua @ 12426:7a3da1acace1
net.connect: Improve logging on connection attempt failure
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 21 Mar 2022 11:15:30 +0000 |
| parents | eabcc3ae22e9 |
| children | 353836684009 |
comparison
equal
deleted
inserted
replaced
| 12425:eabcc3ae22e9 | 12426:7a3da1acace1 |
|---|---|
| 91 return; | 91 return; |
| 92 end | 92 end |
| 93 p.conns[conn] = nil; | 93 p.conns[conn] = nil; |
| 94 p.last_error = reason or "unknown reason"; | 94 p.last_error = reason or "unknown reason"; |
| 95 p:log("debug", "Connection attempt failed: %s", p.last_error); | 95 p:log("debug", "Connection attempt failed: %s", p.last_error); |
| 96 if next(p.conns) == nil and not p.connected then | 96 if p.connected then |
| 97 p:log("debug", "Connection already established, ignoring failure"); | |
| 98 elseif next(p.conns) == nil then | |
| 97 p:log("debug", "No pending connection attempts, and not yet connected"); | 99 p:log("debug", "No pending connection attempts, and not yet connected"); |
| 98 attempt_connection(p); | 100 attempt_connection(p); |
| 101 else | |
| 102 p:log("debug", "Other attempts are still pending, ignoring failure"); | |
| 99 end | 103 end |
| 100 end | 104 end |
| 101 | 105 |
| 102 local function connect(target_resolver, listeners, options, data) | 106 local function connect(target_resolver, listeners, options, data) |
| 103 local p = setmetatable({ | 107 local p = setmetatable({ |
