summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2012-12-27 23:25:38 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2012-12-27 23:25:38 +0000
commit08bc06b2af10de919da2e8ea74b21392b2e4f03b (patch)
tree8ddbf899f6cd1d9a82680812dc6a39520ba50c80
parentb52db507d42582ae28f63964b2274439bd07da46 (diff)
downloadrabbitmq-server-08bc06b2af10de919da2e8ea74b21392b2e4f03b.tar.gz
only invoke control_throttle when necesseary
-rw-r--r--src/rabbit_reader.erl35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index 0296537d..83622a9f 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -598,35 +598,34 @@ process_frame(Frame, Channel, State) ->
undefined -> create_channel(Channel, State);
Other -> Other
end,
- case process_channel_frame(Frame, ChPid, AState) of
- {ok, NewAState} -> put({channel, Channel}, {ChPid, NewAState}),
- post_process_frame(Frame, ChPid, State);
- {error, Reason} -> handle_exception(State, Channel, Reason)
- end.
-
-process_channel_frame(Frame, ChPid, AState) ->
case rabbit_command_assembler:process(Frame, AState) of
- {ok, NewAState} -> {ok, NewAState};
- {ok, Method, NewAState} -> rabbit_channel:do(ChPid, Method),
- {ok, NewAState};
- {ok, Method, Content, NewAState} -> rabbit_channel:do_flow(
- ChPid, Method, Content),
- {ok, NewAState};
- {error, Reason} -> {error, Reason}
+ {ok, NewAState} ->
+ put({channel, Channel}, {ChPid, NewAState}),
+ post_process_frame(Frame, ChPid, State);
+ {ok, Method, NewAState} ->
+ rabbit_channel:do(ChPid, Method),
+ put({channel, Channel}, {ChPid, NewAState}),
+ post_process_frame(Frame, ChPid, State);
+ {ok, Method, Content, NewAState} ->
+ rabbit_channel:do_flow(ChPid, Method, Content),
+ put({channel, Channel}, {ChPid, NewAState}),
+ post_process_frame(Frame, ChPid, control_throttle(State));
+ {error, Reason} ->
+ {error, Reason}
end.
post_process_frame({method, 'channel.close_ok', _}, ChPid, State) ->
channel_cleanup(ChPid),
- control_throttle(State);
+ State;
post_process_frame({method, MethodName, _}, _ChPid,
State = #v1{connection = #connection{
protocol = Protocol}}) ->
case Protocol:method_has_content(MethodName) of
- true -> maybe_block(control_throttle(State));
- false -> control_throttle(State)
+ true -> maybe_block(State);
+ false -> State
end;
post_process_frame(_Frame, _ChPid, State) ->
- control_throttle(State).
+ State.
%%--------------------------------------------------------------------------