mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Fix external components unregistration
This commit is contained in:
parent
032f796292
commit
a65500b6aa
@ -213,17 +213,27 @@ handle_info(Info, State) ->
|
|||||||
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
?ERROR_MSG("Unexpected info: ~p", [Info]),
|
||||||
State.
|
State.
|
||||||
|
|
||||||
terminate(Reason, #{stream_state := StreamState, host_opts := HostOpts}) ->
|
terminate(Reason, #{stream_state := StreamState,
|
||||||
|
host_opts := HostOpts,
|
||||||
|
remote_server := RemoteServer,
|
||||||
|
global_routes := GlobalRoutes}) ->
|
||||||
case StreamState of
|
case StreamState of
|
||||||
established ->
|
established ->
|
||||||
|
Routes = if GlobalRoutes ->
|
||||||
|
dict:fetch_keys(HostOpts);
|
||||||
|
true ->
|
||||||
|
[RemoteServer]
|
||||||
|
end,
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(H) ->
|
fun(H) ->
|
||||||
ejabberd_router:unregister_route(H),
|
ejabberd_router:unregister_route(H),
|
||||||
ejabberd_hooks:run(component_disconnected, [H, Reason])
|
ejabberd_hooks:run(component_disconnected, [H, Reason])
|
||||||
end, dict:fetch_keys(HostOpts));
|
end, Routes);
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
end.
|
end;
|
||||||
|
terminate(_Reason, _State) ->
|
||||||
|
ok.
|
||||||
|
|
||||||
code_change(_OldVsn, State, _Extra) ->
|
code_change(_OldVsn, State, _Extra) ->
|
||||||
{ok, State}.
|
{ok, State}.
|
||||||
|
Loading…
Reference in New Issue
Block a user