aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_event.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
commit0ac9ea3a74eddc8449f86b15081a48077a00eebf (patch)
tree9e04d366c38c06a01edc5c3951a2f0f5c7ee03e1 /net/server_event.lua
parente1aa03deaa892fa5edbdeb182dd009a60d68146d (diff)
downloadprosody-0ac9ea3a74eddc8449f86b15081a48077a00eebf.tar.gz
prosody-0ac9ea3a74eddc8449f86b15081a48077a00eebf.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_event.lua')
-rw-r--r--net/server_event.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/server_event.lua b/net/server_event.lua
index ff3f921b..11bd6a29 100644
--- a/net/server_event.lua
+++ b/net/server_event.lua
@@ -747,7 +747,7 @@ local function addclient( addr, serverport, listener, pattern, sslctx, typ )
return nil, err
end
client:settimeout( 0 ) -- set nonblocking
- local res, err = client:connect( addr, serverport ) -- connect
+ local res, err = client:setpeername( addr, serverport ) -- connect
if res or ( err == "timeout" ) then
local ip, port = client:getsockname( )
local interface = wrapclient( client, ip, serverport, listener, pattern, sslctx )