diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-07-24 14:36:26 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-07-24 14:36:26 +0200 |
| commit | 27a52f401cd17700f86e896f4df356619bbde405 (patch) | |
| tree | 95cfbb9177c0e7323d772c16bf25c205730d708f /src | |
| parent | 342c36370ddb08a047e4f6221447f684e6e1ba6e (diff) | |
| download | rabbitmq-server-git-27a52f401cd17700f86e896f4df356619bbde405.tar.gz | |
rabbit_networking: Re-enable Dialyzer in this file
The function spec of `erl_epmd:port_please/3` was fixed in Erlang 23. we
can re-enable Dialyzer in this file.
This was mandatory anyway, otherwise disabling Dialyzer for this one
triggered the following warning in rabbit:do_run_postlaunch_phase/0:
rabbit.erl:1059: Function log_broker_started/1 will never be called
That's because the pattern matching we did on the return value of
`erl_epmd:port_please/{2,3}` was considered incorrect by Dialyzer,
causing a possible crash. The crash would happen before
`log_broker_started/1` would be called, which meant
`log_broker_started/1` would be dead code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_networking.erl | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index 966601d222..63760cd2e3 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -67,12 +67,7 @@ -type protocol() :: atom(). -type label() :: string(). -%% @todo Remove once Dialyzer only runs on Erlang/OTP 21.3 or above. --dialyzer({nowarn_function, boot/0}). --dialyzer({nowarn_function, boot_listeners/3}). --dialyzer({nowarn_function, record_distribution_listener/0}). - --spec boot() -> 'ok'. +-spec boot() -> 'ok' | no_return(). boot() -> ok = record_distribution_listener(), @@ -338,10 +333,16 @@ tcp_listener_stopped(Protocol, Opts, IPAddress, Port) -> port = Port, opts = Opts}). +-spec record_distribution_listener() -> ok | no_return(). + record_distribution_listener() -> {Name, Host} = rabbit_nodes:parts(node()), - {port, Port, _Version} = erl_epmd:port_please(Name, Host), - tcp_listener_started(clustering, [], {0,0,0,0,0,0,0,0}, Port). + case erl_epmd:port_please(Name, Host, infinity) of + {port, Port, _Version} -> + tcp_listener_started(clustering, [], {0,0,0,0,0,0,0,0}, Port); + noport -> + throw({error, no_epmd_port}) + end. -spec active_listeners() -> [rabbit_types:listener()]. |
