Software /
code /
prosody
Comparison
plugins/mod_s2s/s2sout.lib.lua @ 5700:94081567ea9e
mod_s2s/s2sout.lib: Only attempt to create an IPv6 socket if LuaSocket supports IPv6
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 18 Jun 2013 12:11:40 +0100 |
parent | 5552:40e7a6cf15ff |
child | 5701:746b263e09cf |
comparison
equal
deleted
inserted
replaced
5699:e9f5384f5ff1 | 5700:94081567ea9e |
---|---|
274 -- Reset secure flag in case this is another | 274 -- Reset secure flag in case this is another |
275 -- connection attempt after a failed STARTTLS | 275 -- connection attempt after a failed STARTTLS |
276 host_session.secure = nil; | 276 host_session.secure = nil; |
277 | 277 |
278 local conn, handler; | 278 local conn, handler; |
279 if connect_host.proto == "IPv4" then | 279 local proto = connect_host.proto; |
280 if proto == "IPv4" then | |
280 conn, handler = socket.tcp(); | 281 conn, handler = socket.tcp(); |
282 elseif proto == "IPv6" and socket.tcp6 then | |
283 conn, handler = socket.tcp6(); | |
281 else | 284 else |
282 conn, handler = socket.tcp6(); | 285 handler = "Unsupported protocol: "..tostring(proto); |
283 end | 286 end |
284 | 287 |
285 if not conn then | 288 if not conn then |
286 log("warn", "Failed to create outgoing connection, system error: %s", handler); | 289 log("warn", "Failed to create outgoing connection, system error: %s", handler); |
287 return false, handler; | 290 return false, handler; |