Software /
code /
prosody
Comparison
net/server_select.lua @ 5967:3b7206981317
net.server_{select,event}: addclient: Handle missing getaddrinfo
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 23 Dec 2013 23:23:59 +0100 |
parent | 5966:958ad646c0f2 |
child | 6055:596539a30e9b |
comparison
equal
deleted
inserted
replaced
5966:958ad646c0f2 | 5967:3b7206981317 |
---|---|
940 elseif type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then | 940 elseif type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then |
941 err = "invalid port" | 941 err = "invalid port" |
942 elseif sslctx and not has_luasec then | 942 elseif sslctx and not has_luasec then |
943 err = "luasec not found" | 943 err = "luasec not found" |
944 end | 944 end |
945 if not typ then | 945 if getaddrinfo and not typ then |
946 local addrinfo, err = getaddrinfo(address) | 946 local addrinfo, err = getaddrinfo(address) |
947 if not addrinfo then return nil, err end | 947 if not addrinfo then return nil, err end |
948 if addrinfo[1] and addrinfo[1].family == "inet6" then | 948 if addrinfo[1] and addrinfo[1].family == "inet6" then |
949 typ = "tcp6" | 949 typ = "tcp6" |
950 else | 950 end |
951 typ = "tcp" | 951 end |
952 end | 952 local create = luasocket[typ or "tcp"] |
953 end | |
954 local create = luasocket[typ] | |
955 if type( create ) ~= "function" then | 953 if type( create ) ~= "function" then |
956 err = "invalid socket type" | 954 err = "invalid socket type" |
957 end | 955 end |
958 | 956 |
959 if err then | 957 if err then |