diff options
| author | Simon MacMullen <simon@rabbitmq.com> | 2013-01-17 17:16:46 +0000 |
|---|---|---|
| committer | Simon MacMullen <simon@rabbitmq.com> | 2013-01-17 17:16:46 +0000 |
| commit | f82424746f7c0ea7ca0a1f5e2c1d210752073a8b (patch) | |
| tree | c4dce277d70beb617f1523c8803371b73bfe3734 | |
| parent | 5b862d05d12add1bd5c984761c6b6655ff2cddfb (diff) | |
| download | rabbitmq-server-git-f82424746f7c0ea7ca0a1f5e2c1d210752073a8b.tar.gz | |
Stick "real" 0-9-1 connections in an ETS table.
| -rw-r--r-- | include/rabbit.hrl | 2 | ||||
| -rw-r--r-- | src/rabbit_networking.erl | 13 | ||||
| -rw-r--r-- | src/rabbit_reader.erl | 2 |
3 files changed, 8 insertions, 9 deletions
diff --git a/include/rabbit.hrl b/include/rabbit.hrl index 7385b4b3c0..397a3df6f6 100644 --- a/include/rabbit.hrl +++ b/include/rabbit.hrl @@ -109,3 +109,5 @@ -define(INVALID_HEADERS_KEY, <<"x-invalid-headers">>). -define(ROUTING_HEADERS, [<<"CC">>, <<"BCC">>]). -define(DELETED_HEADER, <<"BCC">>). + +-define(CONNECTION_TABLE, rabbit_connection). diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl index 31eeef730c..52163354b6 100644 --- a/src/rabbit_networking.erl +++ b/src/rabbit_networking.erl @@ -117,6 +117,9 @@ %%---------------------------------------------------------------------------- boot() -> + %% This exists to disambiguate 0-x connections from 1.0 ones + %% (since they are both children of the same supervisor). + ets:new(?CONNECTION_TABLE, [public, named_table]), ok = start(), ok = boot_tcp(), ok = boot_ssl(). @@ -299,15 +302,7 @@ connections() -> rabbit_networking, connections_local, []). connections_local() -> - [Reader || - {_, ConnSup, supervisor, _} - <- supervisor:which_children(rabbit_tcp_client_sup), - Reader <- [try - rabbit_connection_sup:reader(ConnSup) - catch exit:{noproc, _} -> - noproc - end], - Reader =/= noproc]. + [P || {P} <- ets:tab2list(?CONNECTION_TABLE)]. connection_info_keys() -> rabbit_reader:info_keys(). diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index e146216357..fae65b1dbe 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -265,6 +265,7 @@ start_connection(Parent, ConnSupPid, Collector, StartHeartbeatFun, Deb, %% the socket. However, to keep the file_handle_cache %% accounting as accurate as possible we ought to close the %% socket w/o delay before termination. + ets:delete(?CONNECTION_TABLE, self()), rabbit_net:fast_close(ClientSock), rabbit_event:notify(connection_closed, [{pid, self()}]) end, @@ -721,6 +722,7 @@ handle_input(Callback, Data, _State) -> start_connection({ProtocolMajor, ProtocolMinor, _ProtocolRevision}, Protocol, State = #v1{sock = Sock, connection = Connection}) -> + ets:insert(?CONNECTION_TABLE, {self()}), Start = #'connection.start'{ version_major = ProtocolMajor, version_minor = ProtocolMinor, |
