Comparison

net/connect.lua @ 10563:e8db377a2983

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Tue, 24 Dec 2019 00:39:45 +0100
parent 10485:913276ba0c47
child 10612:44ef46e1a951
comparison
equal deleted inserted replaced
10562:670afc079f68 10563:e8db377a2983
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 Respect use_ipv4, use_ipv6
6 -- TODO #1246 Happy Eyeballs
7 -- FIXME RFC 6724
8 -- FIXME Error propagation from resolvers doesn't work
9 -- FIXME #1428 Reuse DNS resolver object between service and basic resolver
10 -- FIXME #1429 Close DNS resolver object when done
4 11
5 local pending_connection_methods = {}; 12 local pending_connection_methods = {};
6 local pending_connection_mt = { 13 local pending_connection_mt = {
7 __name = "pending_connection"; 14 __name = "pending_connection";
8 __index = pending_connection_methods; 15 __index = pending_connection_methods;
36 return; 43 return;
37 end 44 end
38 p:log("debug", "Next target to try is %s:%d", ip, port); 45 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); 46 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 47 if not conn then
41 log("debug", "Connection attempt failed immediately: %s", tostring(err)); 48 log("debug", "Connection attempt failed immediately: %s", err);
42 p.last_error = err or "unknown reason"; 49 p.last_error = err or "unknown reason";
43 return attempt_connection(p); 50 return attempt_connection(p);
44 end 51 end
45 p.conn = conn; 52 p.conn = conn;
46 pending_connections_map[conn] = p; 53 pending_connections_map[conn] = p;