]> granicus.if.org Git - ejabberd/commitdiff
Fix case clause
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 25 May 2017 10:46:17 +0000 (13:46 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 25 May 2017 10:46:17 +0000 (13:46 +0300)
Fixes #1746

src/ejabberd_s2s.erl

index d972f5866d1d8a488a5dc7990114fb4e6619ae9b..4b74b8c4a4554d4c414a174a5e119f7c7ae3c2af 100644 (file)
@@ -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]),