Changeset

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
parents 5699:e9f5384f5ff1
children 5701:746b263e09cf
files plugins/mod_s2s/s2sout.lib.lua
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_s2s/s2sout.lib.lua	Tue Jun 18 09:04:44 2013 +0100
+++ b/plugins/mod_s2s/s2sout.lib.lua	Tue Jun 18 12:11:40 2013 +0100
@@ -276,10 +276,13 @@
 	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();
+	elseif proto == "IPv6" and socket.tcp6 then
+		conn, handler = socket.tcp6();
 	else
-		conn, handler = socket.tcp6();
+		handler = "Unsupported protocol: "..tostring(proto);
 	end
 	
 	if not conn then