summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2010-07-20 12:25:56 +0100
committerSimon MacMullen <simon@rabbitmq.com>2010-07-20 12:25:56 +0100
commit88e22f5b85aff7d678f13ebb16507b353c28eb9b (patch)
tree4520dffe0f228e898183b0c0ef543763296eb6c5
parent3579c99cdaf9752fada6098ed40886b76b3e958c (diff)
downloadrabbitmq-server-git-88e22f5b85aff7d678f13ebb16507b353c28eb9b.tar.gz
This function was merged wrong; fix.
-rw-r--r--src/rabbit_framing_channel.erl29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/rabbit_framing_channel.erl b/src/rabbit_framing_channel.erl
index 6739b3d6f8..333604c835 100644
--- a/src/rabbit_framing_channel.erl
+++ b/src/rabbit_framing_channel.erl
@@ -73,16 +73,25 @@ read_frame(ChannelPid) ->
end.
mainloop(ChannelPid, Protocol) ->
- {method, MethodName, FieldsBin} = read_frame(ChannelPid),
- Method = Protocol:decode_method_fields(MethodName, FieldsBin),
- case Protocol:method_has_content(MethodName) of
- true -> {ClassId, _MethodId} = Protocol:method_id(MethodName),
- rabbit_channel:do(ChannelPid, Method,
- collect_content(ChannelPid, ClassId,
- Protocol));
- false -> rabbit_channel:do(ChannelPid, Method)
- end,
- ?MODULE:mainloop(ChannelPid, Protocol).
+ Decoded = read_frame(ChannelPid),
+ case Decoded of
+ {method, MethodName, FieldsBin} ->
+ Method = Protocol:decode_method_fields(MethodName, FieldsBin),
+ case Protocol:method_has_content(MethodName) of
+ true -> {ClassId, _MethodId} = Protocol:method_id(MethodName),
+ rabbit_channel:do(ChannelPid, Method,
+ collect_content(ChannelPid,
+ ClassId,
+ Protocol));
+ false -> rabbit_channel:do(ChannelPid, Method)
+ end,
+ ?MODULE:mainloop(ChannelPid, Protocol);
+ _ ->
+ rabbit_misc:protocol_error(
+ unexpected_frame,
+ "expected method frame, got ~p instead",
+ [Decoded])
+ end.
collect_content(ChannelPid, ClassId, Protocol) ->
case read_frame(ChannelPid) of