From 1ac7b7a3b7659d52221e382e32b5eec18722e27a Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 25 Feb 2010 17:52:33 +0000 Subject: s2smanager: Fix for the logic SRV record priority comparison (thanks darkrain) --- core/s2smanager.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 20d932e8..e37cac73 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -50,7 +50,9 @@ local incoming_s2s = incoming_s2s; module "s2smanager" -local function compare_srv_priorities(a,b) return a.priority < b.priority or a.weight < b.weight; end +function compare_srv_priorities(a,b) + return a.priority < b.priority or (a.priority == b.priority and a.weight > b.weight); +end local function bounce_sendq(session) local sendq = session.sendq; -- cgit v1.2.3 From f713f780454c2a67e67d316447ad9a5da88e5731 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 25 Feb 2010 17:53:27 +0000 Subject: s2smanager: Log and fail gracefully when unable to create socket for outgoing s2s connection (thanks foucault) --- core/s2smanager.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') diff --git a/core/s2smanager.lua b/core/s2smanager.lua index e37cac73..bfa3069a 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -306,6 +306,11 @@ function make_connect(host_session, connect_host, connect_port) local from_host, to_host = host_session.from_host, host_session.to_host; local conn, handler = socket.tcp() + + if not conn then + log("warn", "Failed to create outgoing connection, system error: %s", handler); + return false, handler; + end conn:settimeout(0); local success, err = conn:connect(connect_host, connect_port); -- cgit v1.2.3