Extract rabbit_networking:stop_ranch_listener_of_protocol/1

Part of rabbitmq/rabbitmq-server#2321
This commit is contained in:
Michael Klishin 2020-07-09 22:02:09 +03:00
parent d31d88baf0
commit f1f8425103
1 changed files with 2 additions and 9 deletions

View File

@ -50,8 +50,8 @@ prep_stop(State) ->
-spec stop(_) -> ok.
stop(_State) ->
stop_ranch_listener(?TCP_PROTOCOL),
stop_ranch_listener(?TLS_PROTOCOL),
rabbit_networking:stop_ranch_listener_of_protocol(?TCP_PROTOCOL),
rabbit_networking:stop_ranch_listener_of_protocol(?TLS_PROTOCOL),
ok.
init([]) -> {ok, {{one_for_one, 1, 5}, []}}.
@ -73,13 +73,6 @@ close_all_client_connections(Reason) ->
%% Implementation
%%
stop_ranch_listener(Protocol) ->
case rabbit_networking:ranch_ref_of_protocol(Protocol) of
{error, not_found} -> ok;
undefined -> ok;
Ref -> ranch:stop_listener(Ref)
end.
connection_pids_of_protocol(Protocol) ->
case rabbit_networking:ranch_ref_of_protocol(Protocol) of
undefined -> [];