diff options
author | Kim Alvefur <zash@zash.se> | 2013-12-23 23:23:59 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2013-12-23 23:23:59 +0100 |
commit | 29d3c27219e71e8f2ed0c835bb83333ca5ce9fbc (patch) | |
tree | 6a978cbce4e9c3704bf79dee8ae4fa00dcab13e2 /net | |
parent | bcb9af93c22dba3008a79ecd44eb947c2c7cd910 (diff) | |
download | prosody-29d3c27219e71e8f2ed0c835bb83333ca5ce9fbc.tar.gz prosody-29d3c27219e71e8f2ed0c835bb83333ca5ce9fbc.zip |
net.server_{select,event}: addclient: Handle missing getaddrinfo
Diffstat (limited to 'net')
-rw-r--r-- | net/server_event.lua | 6 | ||||
-rw-r--r-- | net/server_select.lua | 6 |
2 files changed, 4 insertions, 8 deletions
diff --git a/net/server_event.lua b/net/server_event.lua index 1a3b8ca6..ef0a27d8 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -742,16 +742,14 @@ do debug "need luasec, but not available" return nil, "luasec not found" end - if not typ then + if getaddrinfo and not typ then local addrinfo, err = getaddrinfo(addr) 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 = socket[typ] + local create = socket[typ or "tcp"] if type( create ) ~= "function" then return nil, "invalid socket type" end 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 |