25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-20 17:27:00 +01:00

Don't forget to unregister route when the owning process is dead

This commit is contained in:
Evgeny Khramtsov 2019-07-18 21:48:53 +03:00
parent 3f7d9e3ad6
commit ad902c2e16

View File

@ -358,6 +358,9 @@ handle_info({'DOWN', MRef, _, Pid, Info}, State) ->
?DEBUG("Process ~p with route registered to ~s " ?DEBUG("Process ~p with route registered to ~s "
"has terminated unexpectedly with reason: ~p", "has terminated unexpectedly with reason: ~p",
[P, Domain, Info]), [P, Domain, Info]),
try unregister_route(Domain, Pid)
catch _:_ -> ok
end,
false; false;
(_, _) -> (_, _) ->
true true
@ -462,7 +465,12 @@ monitor_route(Domain, Pid) ->
-spec demonitor_route(binary(), pid()) -> ok. -spec demonitor_route(binary(), pid()) -> ok.
demonitor_route(Domain, Pid) -> demonitor_route(Domain, Pid) ->
?GEN_SERVER:call(?MODULE, {demonitor, Domain, Pid}, ?CALL_TIMEOUT). case whereis(?MODULE) == self() of
true ->
ok;
false ->
?GEN_SERVER:call(?MODULE, {demonitor, Domain, Pid}, ?CALL_TIMEOUT)
end.
-spec get_backend() -> module(). -spec get_backend() -> module().
get_backend() -> get_backend() ->