aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-12-23 23:23:59 +0100
committerKim Alvefur <zash@zash.se>2013-12-23 23:23:59 +0100
commit195743afe083f3b66a4fa2cd594e75f150e81968 (patch)
tree6a978cbce4e9c3704bf79dee8ae4fa00dcab13e2 /net/server_select.lua
parentcf48e76e783abc6925a78a4a3750d3a1cbaaf864 (diff)
downloadprosody-195743afe083f3b66a4fa2cd594e75f150e81968.tar.gz
prosody-195743afe083f3b66a4fa2cd594e75f150e81968.zip
net.server_{select,event}: addclient: Handle missing getaddrinfo
Diffstat (limited to 'net/server_select.lua')
-rw-r--r--net/server_select.lua6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index ee9cac7e..b69b5fc7 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -942,16 +942,14 @@ local addclient = function( address, port, listeners, pattern, sslctx, typ )
elseif sslctx and not has_luasec then
err = "luasec not found"
end
- if not typ then
+ if getaddrinfo and not typ then
local addrinfo, err = getaddrinfo(address)
if not addrinfo then return nil, err end
if addrinfo[1] and addrinfo[1].family == "inet6" then
typ = "tcp6"
- else
- typ = "tcp"
end
end
- local create = luasocket[typ]
+ local create = luasocket[typ or "tcp"]
if type( create ) ~= "function" then
err = "invalid socket type"
end