summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_connection_sup.erl8
-rw-r--r--src/rabbit_networking.erl6
2 files changed, 10 insertions, 4 deletions
diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl
index b2aba2eeb0..3c344ba0cc 100644
--- a/src/rabbit_connection_sup.erl
+++ b/src/rabbit_connection_sup.erl
@@ -29,7 +29,7 @@
-ifdef(use_specs).
-spec(start_link/0 :: () -> {'ok', pid(), pid()}).
--spec(reader/1 :: (pid()) -> pid()).
+-spec(reader/1 :: (pid()) -> pid() | noproc).
-endif.
@@ -57,7 +57,11 @@ start_link() ->
{ok, SupPid, ReaderPid}.
reader(Pid) ->
- hd(supervisor2:find_child(Pid, reader)).
+ try
+ hd(supervisor2:find_child(Pid, reader))
+ catch exit:{noproc, _} ->
+ noproc
+ end.
%%--------------------------------------------------------------------------
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index 2c0912dfd6..146d04cdbe 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -307,9 +307,11 @@ connections() ->
rabbit_networking, connections_local, []).
connections_local() ->
- [rabbit_connection_sup:reader(ConnSup) ||
+ [Reader ||
{_, ConnSup, supervisor, _}
- <- supervisor:which_children(rabbit_tcp_client_sup)].
+ <- supervisor:which_children(rabbit_tcp_client_sup),
+ Reader <- [rabbit_connection_sup:reader(ConnSup)],
+ Reader =/= noproc].
connection_info_keys() -> rabbit_reader:info_keys().