aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_s2s/s2sout.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-06-18 12:11:40 +0100
committerMatthew Wild <mwild1@gmail.com>2013-06-18 12:11:40 +0100
commitdb9c9117116b1a1bc7889d6f79c35e98b9220d1a (patch)
treed4b603b1c84d57c06ed69ee173f6712510eaadac /plugins/mod_s2s/s2sout.lib.lua
parenta3a07bfbc1adb440340c8043b746c70622486f02 (diff)
downloadprosody-db9c9117116b1a1bc7889d6f79c35e98b9220d1a.tar.gz
prosody-db9c9117116b1a1bc7889d6f79c35e98b9220d1a.zip
mod_s2s/s2sout.lib: Only attempt to create an IPv6 socket if LuaSocket supports IPv6
Diffstat (limited to 'plugins/mod_s2s/s2sout.lib.lua')
-rw-r--r--plugins/mod_s2s/s2sout.lib.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/mod_s2s/s2sout.lib.lua b/plugins/mod_s2s/s2sout.lib.lua
index cb2f8be4..9e26dbee 100644
--- a/plugins/mod_s2s/s2sout.lib.lua
+++ b/plugins/mod_s2s/s2sout.lib.lua
@@ -276,10 +276,13 @@ function s2sout.make_connect(host_session, connect_host, connect_port)
host_session.secure = nil;
local conn, handler;
- if connect_host.proto == "IPv4" then
+ local proto = connect_host.proto;
+ if proto == "IPv4" then
conn, handler = socket.tcp();
- else
+ elseif proto == "IPv6" and socket.tcp6 then
conn, handler = socket.tcp6();
+ else
+ handler = "Unsupported protocol: "..tostring(proto);
end
if not conn then