Software /
code /
prosody
Changeset
10623:f51c88baeb8a
Backed out changeset 44ef46e1a951 (not optimal API)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 25 Jan 2020 14:25:29 +0000 |
parents | 10622:0662fe0e2c31 |
children | 10624:0725b7b8dc14 |
files | net/connect.lua |
diffstat | 1 files changed, 12 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/net/connect.lua Sat Jan 25 14:25:21 2020 +0000 +++ b/net/connect.lua Sat Jan 25 14:25:29 2020 +0000 @@ -2,17 +2,13 @@ local log = require "util.logger".init("net.connect"); local new_id = require "util.id".short; +-- TODO Respect use_ipv4, use_ipv6 -- TODO #1246 Happy Eyeballs -- FIXME RFC 6724 -- FIXME Error propagation from resolvers doesn't work -- FIXME #1428 Reuse DNS resolver object between service and basic resolver -- FIXME #1429 Close DNS resolver object when done -local default_connector_options = { - use_ipv4 = true; - use_ipv6 = true; -}; - local pending_connection_methods = {}; local pending_connection_mt = { __name = "pending_connection"; @@ -82,24 +78,19 @@ attempt_connection(p); end -local function new_connector(connector_options) - local function connect(target_resolver, listeners, options, data) - local p = setmetatable({ - id = new_id(); - target_resolver = target_resolver; - listeners = assert(listeners); - options = options or {}; - data = data; - connector_options = connector_options or default_connector_options; - }, pending_connection_mt); +local function connect(target_resolver, listeners, options, data) + local p = setmetatable({ + id = new_id(); + target_resolver = target_resolver; + listeners = assert(listeners); + options = options or {}; + data = data; + }, pending_connection_mt); - p:log("debug", "Starting connection process"); - attempt_connection(p); - end - return connect; + p:log("debug", "Starting connection process"); + attempt_connection(p); end return { - connect = new_connector(default_connector_options); - new_connector = new_connector; + connect = connect; };