Mercurial > prosody-hg
comparison net/connect.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | 2edb72ef312a |
| children | 26406ce35e20 |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 1 local server = require "net.server"; | 1 local server = require "net.server"; |
| 2 local log = require "util.logger".init("net.connect"); | 2 local log = require "util.logger".init("net.connect"); |
| 3 local new_id = require "util.id".short; | 3 local new_id = require "util.id".short; |
| 4 | |
| 5 -- TODO #1246 Happy Eyeballs | |
| 6 -- FIXME RFC 6724 | |
| 7 -- FIXME Error propagation from resolvers doesn't work | |
| 8 -- FIXME #1428 Reuse DNS resolver object between service and basic resolver | |
| 9 -- FIXME #1429 Close DNS resolver object when done | |
| 4 | 10 |
| 5 local pending_connection_methods = {}; | 11 local pending_connection_methods = {}; |
| 6 local pending_connection_mt = { | 12 local pending_connection_mt = { |
| 7 __name = "pending_connection"; | 13 __name = "pending_connection"; |
| 8 __index = pending_connection_methods; | 14 __index = pending_connection_methods; |
| 36 return; | 42 return; |
| 37 end | 43 end |
| 38 p:log("debug", "Next target to try is %s:%d", ip, port); | 44 p:log("debug", "Next target to try is %s:%d", ip, port); |
| 39 local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra); | 45 local conn, err = server.addclient(ip, port, pending_connection_listeners, p.options.pattern or "*a", p.options.sslctx, conn_type, extra); |
| 40 if not conn then | 46 if not conn then |
| 41 log("debug", "Connection attempt failed immediately: %s", tostring(err)); | 47 log("debug", "Connection attempt failed immediately: %s", err); |
| 42 p.last_error = err or "unknown reason"; | 48 p.last_error = err or "unknown reason"; |
| 43 return attempt_connection(p); | 49 return attempt_connection(p); |
| 44 end | 50 end |
| 45 p.conn = conn; | 51 p.conn = conn; |
| 46 pending_connections_map[conn] = p; | 52 pending_connections_map[conn] = p; |
