summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2010-07-09 12:21:59 +0100
committerSimon MacMullen <simon@rabbitmq.com>2010-07-09 12:21:59 +0100
commit790be96b599b1089a86a0941aa9b07f5c38a13f9 (patch)
tree18e5ddf346d4637c70f0568118a5d6cf8d5c3b74
parent9a23f57b495dd616671880dcdab841b174766a82 (diff)
downloadrabbitmq-server-790be96b599b1089a86a0941aa9b07f5c38a13f9.tar.gz
Don't change the signature of ensure_content_decoded.
-rw-r--r--src/rabbit_basic.erl5
-rw-r--r--src/rabbit_binary_parser.erl9
-rw-r--r--src/rabbit_channel.erl3
3 files changed, 9 insertions, 8 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index 3117e98e..6e8481ad 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -93,9 +93,10 @@ from_content(Content) ->
#content{class_id = ClassId,
properties = Props,
payload_fragments_rev = FragmentsRev} =
- rabbit_binary_parser:ensure_content_decoded(Content),
- {ClassId, _MethodId} =
%% basic.publish hasn't changed so we can just hard-code amqp_0_9_1
+ rabbit_binary_parser:ensure_content_decoded(Content,
+ rabbit_framing_amqp_0_9_1),
+ {ClassId, _MethodId} =
rabbit_framing_amqp_0_9_1:method_id('basic.publish'),
{Props, list_to_binary(lists:reverse(FragmentsRev))}.
diff --git a/src/rabbit_binary_parser.erl b/src/rabbit_binary_parser.erl
index b1c7c327..633be6f0 100644
--- a/src/rabbit_binary_parser.erl
+++ b/src/rabbit_binary_parser.erl
@@ -34,7 +34,7 @@
-include("rabbit.hrl").
-export([parse_table/1, parse_properties/2]).
--export([ensure_content_decoded/1, clear_decoded_content/1]).
+-export([ensure_content_decoded/2, clear_decoded_content/1]).
-import(lists).
@@ -44,7 +44,7 @@
-spec(parse_table/1 :: (binary()) -> amqp_table()).
-spec(parse_properties/2 :: ([amqp_property_type()], binary()) -> [any()]).
--spec(ensure_content_decoded/1 :: (content()) -> decoded_content()).
+-spec(ensure_content_decoded/2 :: (content(), protocol()) -> decoded_content()).
-spec(clear_decoded_content/1 :: (content()) -> undecoded_content()).
-endif.
@@ -159,11 +159,10 @@ parse_property(bit, Rest) ->
parse_property(table, <<Len:32/unsigned, Table:Len/binary, Rest/binary>>) ->
{parse_table(Table), Rest}.
-ensure_content_decoded(Content = #content{properties = Props})
+ensure_content_decoded(Content = #content{properties = Props}, _Protocol)
when Props =/= 'none' ->
Content;
-ensure_content_decoded(Content = #content{properties_bin = PropBin,
- protocol = Protocol})
+ensure_content_decoded(Content = #content{properties_bin = PropBin}, Protocol)
when is_binary(PropBin) ->
Content#content{properties = Protocol:decode_properties(
Content#content.class_id, PropBin)}.
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 55b5d875..213b6624 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -414,7 +414,8 @@ handle_method(#'basic.publish'{exchange = ExchangeNameBin,
Exchange = rabbit_exchange:lookup_or_die(ExchangeName),
%% We decode the content's properties here because we're almost
%% certain to want to look at delivery-mode and priority.
- DecodedContent = rabbit_binary_parser:ensure_content_decoded(Content),
+ DecodedContent = rabbit_binary_parser:ensure_content_decoded(
+ Content, rabbit_framing_amqp_0_9_1),
IsPersistent = is_message_persistent(DecodedContent),
Message = #basic_message{exchange_name = ExchangeName,
routing_key = RoutingKey,