diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2020-07-14 04:53:21 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2020-07-14 04:53:21 +0300 |
| commit | ac714634bd300d306c1b460addc5bf3c978e91a1 (patch) | |
| tree | 1c778ecdb94cbfa094fb1dbbb37889588c58fafd /src | |
| parent | 7689a2e05e9a60d3240b327ec3b70ae6808bd1a1 (diff) | |
| download | rabbitmq-server-git-ac714634bd300d306c1b460addc5bf3c978e91a1.tar.gz | |
Correct two minor issues discovered by Dialyzer
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_core_ff.erl | 11 | ||||
| -rw-r--r-- | src/rabbit_networking.erl | 9 |
2 files changed, 9 insertions, 11 deletions
diff --git a/src/rabbit_core_ff.erl b/src/rabbit_core_ff.erl index 7a8cae5e40..f97170f6ac 100644 --- a/src/rabbit_core_ff.erl +++ b/src/rabbit_core_ff.erl @@ -130,12 +130,11 @@ virtual_host_metadata_migration(_FeatureName, _FeatureProps, is_enabled) -> maintenance_mode_status_migration(FeatureName, _FeatureProps, enable) -> TableName = rabbit_maintenance:status_table_name(), rabbit_log:info("Creating table ~s for feature flag `~s`", [TableName, FeatureName]), - case rabbit_table:create(TableName, rabbit_maintenance:status_table_definition()) of - ok -> - rabbit_table:ensure_table_copy(TableName, node()); - {error, Reason} -> - rabbit_log:error("Failed to create maintenance status table: ~p", [Reason]), - {error, Reason} + try + _ = rabbit_table:create(TableName, rabbit_maintenance:status_table_definition()), + _ = rabbit_table:ensure_table_copy(TableName, node()) + catch throw:Reason -> + rabbit_log:error("Failed to create maintenance status table: ~p", [Reason]) end; maintenance_mode_status_migration(_FeatureName, _FeatureProps, is_enabled) -> rabbit_table:exists(rabbit_maintenance:status_table_name()). diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index ff82a23ab3..966601d222 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -198,7 +198,7 @@ tcp_listener_spec(NamePrefix, {IPAddress, Port, Family}, SocketOpts, modules => [tcp_listener_sup] }. --spec ranch_ref(#listener{} | [{atom(), any()}] | 'undefined') -> ranch:ref(). +-spec ranch_ref(#listener{} | [{atom(), any()}] | 'undefined') -> ranch:ref() | undefined. ranch_ref(#listener{port = Port}) -> [{IPAddress, Port, _Family} | _] = tcp_listener_addresses(Port), {acceptor, IPAddress, Port}; @@ -215,7 +215,7 @@ ranch_ref(undefined) -> ranch_ref(IPAddress, Port) -> {acceptor, IPAddress, Port}. --spec ranch_ref_of_protocol(atom()) -> ranch:ref(). +-spec ranch_ref_of_protocol(atom()) -> ranch:ref() | undefined. ranch_ref_of_protocol(Protocol) -> ranch_ref(listener_of_protocol(Protocol)). @@ -237,9 +237,8 @@ listener_of_protocol(Protocol) -> -spec stop_ranch_listener_of_protocol(atom()) -> ok | {error, not_found}. stop_ranch_listener_of_protocol(Protocol) -> case rabbit_networking:ranch_ref_of_protocol(Protocol) of - {error, not_found} -> ok; - undefined -> ok; - Ref -> + undefined -> ok; + Ref -> rabbit_log:debug("Stopping Ranch listener for protocol ~s", [Protocol]), ranch:stop_listener(Ref) end. |
