summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2010-08-07 23:33:48 +0100
committerMatthias Radestock <matthias@rabbitmq.com>2010-08-07 23:33:48 +0100
commite4e0bccd92e6a6dbe057f8a62daa781c0e0a7b3a (patch)
tree88dcaec8d24d5aa731d1e4ed084848f59f2d4696
parent7b792312738d1042ad65b702c635fa79d80b5264 (diff)
downloadrabbitmq-server-e4e0bccd92e6a6dbe057f8a62daa781c0e0a7b3a.tar.gz
handle transcoding of content when it is not available decoded
-rw-r--r--src/rabbit_binary_generator.erl11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/rabbit_binary_generator.erl b/src/rabbit_binary_generator.erl
index f7a34090..056ab1b5 100644
--- a/src/rabbit_binary_generator.erl
+++ b/src/rabbit_binary_generator.erl
@@ -283,7 +283,16 @@ ensure_content_encoded(Content = #content{properties_bin = PropBin,
protocol = Protocol}, Protocol)
when PropBin =/= none ->
Content;
-ensure_content_encoded(Content = #content{properties = Props}, Protocol) ->
+ensure_content_encoded(Content = #content{properties = none,
+ properties_bin = PropBin,
+ protocol = Protocol}, Protocol1)
+ when PropBin =/= none ->
+ Props = Protocol:decode_properties(Content#content.class_id, PropBin),
+ Content#content{properties = Props,
+ properties_bin = Protocol1:encode_properties(Props),
+ protocol = Protocol1};
+ensure_content_encoded(Content = #content{properties = Props}, Protocol)
+ when Props =/= none ->
Content#content{properties_bin = Protocol:encode_properties(Props),
protocol = Protocol}.