diff options
| author | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-03 11:41:35 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-03 11:41:35 +0100 |
| commit | 215d6eb4451f3f26efb33612e1cb92af82be57ac (patch) | |
| tree | 32a36643fd85d26a02b2329c21ee59219b5760fb /src | |
| parent | 5cad73bd60c0847800350d61db4f6ed295209682 (diff) | |
| download | rabbitmq-server-git-215d6eb4451f3f26efb33612e1cb92af82be57ac.tar.gz | |
Don't dynamically start up the channel_sup_sup - it doesn't gain us much to predeclare it with the Protocol and it makes the children of the channel_sup_sup less obvious
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_channel_sup_sup.erl | 10 | ||||
| -rw-r--r-- | src/rabbit_connection_sup.erl | 4 | ||||
| -rw-r--r-- | src/rabbit_reader.erl | 17 |
3 files changed, 14 insertions, 17 deletions
diff --git a/src/rabbit_channel_sup_sup.erl b/src/rabbit_channel_sup_sup.erl index f608b724ac..2fab867841 100644 --- a/src/rabbit_channel_sup_sup.erl +++ b/src/rabbit_channel_sup_sup.erl @@ -33,16 +33,16 @@ -behaviour(supervisor2). --export([start_link/1, start_channel/2]). +-export([start_link/0, start_channel/2]). -export([init/1]). -start_link(Protocol) -> - supervisor2:start_link(?MODULE, [Protocol]). +start_link() -> + supervisor2:start_link(?MODULE, []). -init([Protocol]) -> +init([]) -> {ok, {{simple_one_for_one_terminate, 0, 1}, - [{channel_sup, {rabbit_channel_sup, start_link, [Protocol]}, + [{channel_sup, {rabbit_channel_sup, start_link, []}, temporary, infinity, supervisor, [rabbit_channel_sup]}]}}. start_channel(Pid, Args) -> diff --git a/src/rabbit_connection_sup.erl b/src/rabbit_connection_sup.erl index 5d05ca28ff..4ad9d3f04e 100644 --- a/src/rabbit_connection_sup.erl +++ b/src/rabbit_connection_sup.erl @@ -44,7 +44,9 @@ start_link() -> init([]) -> {ok, {{one_for_all, 0, 1}, - [{reader, {rabbit_reader, start_link, []}, + [{channel_sup_sup, {rabbit_channel_sup_sup, start_link, []}, + permanent, infinity, supervisor, [rabbit_channel_sup_sup]}, + {reader, {rabbit_reader, start_link, []}, permanent, ?MAX_WAIT, worker, [rabbit_reader]}, {collector, {rabbit_queue_collector, start_link, []}, permanent, ?MAX_WAIT, worker, [rabbit_queue_collector]} diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index 9c984c7aef..24bde74d99 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -615,13 +615,8 @@ handle_input(Callback, Data, _State) -> %% includes a major and minor version number, Luckily 0-9 and 0-9-1 %% are similar enough that clients will be happy with either. start_connection({ProtocolMajor, ProtocolMinor, _ProtocolRevision}, - Protocol, State = #v1{parent = Parent, sock = Sock, + Protocol, State = #v1{sock = Sock, connection = Connection}) -> - {ok, _Pid} = - supervisor:start_child( - Parent, {channel_sup_sup, - {rabbit_channel_sup_sup, start_link, [Protocol]}, - permanent, infinity, supervisor, [rabbit_channel_sup_sup]}), Start = #'connection.start'{ version_major = ProtocolMajor, version_minor = ProtocolMinor, server_properties = server_properties(), @@ -802,17 +797,17 @@ i(Item, #v1{}) -> %%-------------------------------------------------------------------------- -send_to_new_channel(Channel, AnalyzedFrame, - State = #v1{queue_collector = Collector, parent = Parent}) -> +send_to_new_channel(Channel, AnalyzedFrame, State = + #v1{queue_collector = Collector, parent = Parent}) -> #v1{sock = Sock, connection = #connection{ + protocol = Protocol, frame_max = FrameMax, user = #user{username = Username}, vhost = VHost}} = State, ChanSupSup = rabbit_connection_sup:channel_sup_sup(Parent), {ok, ChanSup} = rabbit_channel_sup_sup:start_channel( - ChanSupSup, - [Sock, Channel, FrameMax, self(), - Username, VHost, Collector]), + ChanSupSup, [Protocol, Sock, Channel, FrameMax, self(), + Username, VHost, Collector]), ChPid = rabbit_channel_sup:framing_channel(ChanSup), link(ChPid), put({channel, Channel}, {chpid, ChPid}), |
