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 | a7fb2ee05bc227af8de4a85ef2f217ce32e6bacb (patch) | |
tree | c4dce277d70beb617f1523c8803371b73bfe3734 | |
parent | b235064ef4642a8e3c69a7a04b41cba609355f7c (diff) | |
download | rabbitmq-server-a7fb2ee05bc227af8de4a85ef2f217ce32e6bacb.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 7385b4b3..397a3df6 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 31eeef73..52163354 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 e1462163..fae65b1d 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, |