diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2011-11-24 15:32:31 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2011-11-24 15:32:31 +0000 |
commit | 8138e14cae088583e93377ddd4fecd1981b9d48d (patch) | |
tree | e2ce1652b7d16b84ea386c053a1d29ca55822d77 /src | |
parent | f8bb22faff3fefc47c0dcc434117837e49d0c301 (diff) | |
download | rabbitmq-server-8138e14cae088583e93377ddd4fecd1981b9d48d.tar.gz |
Filter out connections which no longer exist.
Diffstat (limited to 'src')
-rw-r--r-- | src/rabbit_connection_sup.erl | 8 | ||||
-rw-r--r-- | src/rabbit_networking.erl | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl index b2aba2ee..3c344ba0 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 2c0912df..146d04cd 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(). |