diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2013-01-17 17:04:09 +0000 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-01-17 17:04:09 +0000 |
| commit | 5b862d05d12add1bd5c984761c6b6655ff2cddfb (patch) | |
| tree | aea86d907923789fa018c6f6caa6935c8123d780 | |
| parent | 2c8c3a0f78c16eaa0063524748a90d7d88b1f847 (diff) | |
| download | rabbitmq-server-git-5b862d05d12add1bd5c984761c6b6655ff2cddfb.tar.gz | |
delay starting of channel_sup_sup as much as possible
which makes abandoned connection attempts less costly
| -rw-r--r-- | src/rabbit_reader.erl | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index b411f927f4..e146216357 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -37,7 +37,7 @@ -record(v1, {parent, sock, connection, callback, recv_len, pending_recv, connection_state, queue_collector, heartbeater, stats_timer, - channel_sup_sup_pid, conn_sup_pid, start_heartbeat_fun, + conn_sup_pid, channel_sup_sup_pid, start_heartbeat_fun, buf, buf_len, throttle}). -record(connection, {name, host, peer_host, port, peer_port, @@ -720,13 +720,7 @@ handle_input(Callback, Data, _State) -> %% are similar enough that clients will be happy with either. start_connection({ProtocolMajor, ProtocolMinor, _ProtocolRevision}, Protocol, - State = #v1{sock = Sock, connection = Connection, - conn_sup_pid = ConnSupPid}) -> - {ok, ChannelSupSupPid} = - supervisor2:start_child( - ConnSupPid, - {channel_sup_sup, {rabbit_channel_sup_sup, start_link, []}, - intrinsic, infinity, supervisor, [rabbit_channel_sup_sup]}), + State = #v1{sock = Sock, connection = Connection}) -> Start = #'connection.start'{ version_major = ProtocolMajor, version_minor = ProtocolMinor, @@ -737,7 +731,6 @@ start_connection({ProtocolMajor, ProtocolMinor, _ProtocolRevision}, switch_callback(State#v1{connection = Connection#connection{ timeout_sec = ?NORMAL_TIMEOUT, protocol = Protocol}, - channel_sup_sup_pid = ChannelSupSupPid, connection_state = starting}, frame_header, 7). @@ -823,17 +816,24 @@ handle_method0(#'connection.open'{virtual_host = VHostPath}, connection = Connection = #connection{ user = User, protocol = Protocol}, + conn_sup_pid = ConnSupPid, sock = Sock, throttle = Throttle}) -> ok = rabbit_access_control:check_vhost_access(User, VHostPath), NewConnection = Connection#connection{vhost = VHostPath}, ok = send_on_channel0(Sock, #'connection.open_ok'{}, Protocol), Conserve = rabbit_alarm:register(self(), {?MODULE, conserve_resources, []}), + Throttle1 = Throttle#throttle{conserve_resources = Conserve}, + {ok, ChannelSupSupPid} = + supervisor2:start_child( + ConnSupPid, + {channel_sup_sup, {rabbit_channel_sup_sup, start_link, []}, + intrinsic, infinity, supervisor, [rabbit_channel_sup_sup]}), State1 = control_throttle( - State#v1{connection_state = running, - connection = NewConnection, - throttle = Throttle#throttle{ - conserve_resources = Conserve}}), + State#v1{connection_state = running, + connection = NewConnection, + channel_sup_sup_pid = ChannelSupSupPid, + throttle = Throttle1}), rabbit_event:notify(connection_created, [{type, network} | infos(?CREATION_EVENT_KEYS, State1)]), |
