plugins/mod_s2s/s2sout.lib.lua
changeset 5700 94081567ea9e
parent 5552 40e7a6cf15ff
child 5701 746b263e09cf
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;