aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-12 17:36:34 +0200
committerKim Alvefur <zash@zash.se>2018-10-12 17:36:34 +0200
commitf9ffb571e387e6d16adda1e74e91cc78da8b0cc0 (patch)
tree9e04d366c38c06a01edc5c3951a2f0f5c7ee03e1 /net/server_epoll.lua
parent1bb64c04457b584ae9c653f8a1c172e7a36663b6 (diff)
downloadprosody-f9ffb571e387e6d16adda1e74e91cc78da8b0cc0.tar.gz
prosody-f9ffb571e387e6d16adda1e74e91cc78da8b0cc0.zip
net.server: Swich method for connecting sockets with remotes
LuaSocket TCP sockets have have both :connect and :setpeername, which are the exact same function, however UDP sockets only have :setpeername. Switching to :setpeername allows most of this code to be generic wrt TCP/UDP.
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index fb13070b..e0189179 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -645,7 +645,7 @@ local function addclient(addr, port, listeners, read_size, tls_ctx, typ)
local conn, err = create();
local ok, err = conn:settimeout(0);
if not ok then return ok, err; end
- local ok, err = conn:connect(addr, port);
+ local ok, err = conn:setpeername(addr, port);
if not ok and err ~= "timeout" then return ok, err; end
local client = wrapsocket(conn, nil, read_size, listeners, tls_ctx)
local ok, err = client:init();