From: Evgeniy Khramtsov Date: Thu, 25 May 2017 10:46:17 +0000 (+0300) Subject: Fix case clause X-Git-Tag: 17.06-beta~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=50327a0cfc74cc8d17daf0eb79c4e4f87ba3e5f6;p=ejabberd Fix case clause Fixes #1746 --- diff --git a/src/ejabberd_s2s.erl b/src/ejabberd_s2s.erl index d972f5866..4b74b8c4a 100644 --- a/src/ejabberd_s2s.erl +++ b/src/ejabberd_s2s.erl @@ -480,9 +480,13 @@ new_connection(MyServer, Server, From, FromTo, end, TRes = mnesia:transaction(F), case TRes of - {atomic, Pid} -> - ejabberd_s2s_out:connect(Pid), - [Pid]; + {atomic, Pid1} -> + if Pid1 == Pid -> + ejabberd_s2s_out:connect(Pid); + true -> + ejabberd_s2s_out:stop(Pid) + end, + [Pid1]; {aborted, Reason} -> ?ERROR_MSG("failed to register connection ~s -> ~s: ~p", [MyServer, Server, Reason]),