summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2010-04-09 18:27:37 +0100
committerMatthew Sackman <matthew@lshift.net>2010-04-09 18:27:37 +0100
commit45b7eb101b32bda813948c5ba2059ea755ef5bbf (patch)
tree0068c1a594565247a1e81b6d4c2bdd516b8eb6c9
parent60b6bfec41f2ce89fcb494af830d7aa0db85cd10 (diff)
downloadrabbitmq-server-45b7eb101b32bda813948c5ba2059ea755ef5bbf.tar.gz
Fixes
-rw-r--r--src/rabbit_basic.erl10
-rw-r--r--src/rabbit_channel.erl5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index 69bc44cc..3bf0897b 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -49,7 +49,7 @@
-spec(delivery/4 :: (boolean(), boolean(), maybe(txn()), message()) ->
delivery()).
-spec(message/4 :: (exchange_name(), routing_key(), properties_input(),
- binary()) -> message()).
+ binary()) -> (message() | {'error', any()})).
-spec(properties/1 :: (properties_input()) -> amqp_properties()).
-spec(publish/4 :: (exchange_name(), routing_key(), properties_input(),
binary()) -> publish_result()).
@@ -58,8 +58,8 @@
publish_result()).
-spec(build_content/2 :: (amqp_properties(), binary()) -> content()).
-spec(from_content/1 :: (content()) -> {amqp_properties(), binary()}).
--spec(is_message_persistent/1 :: (decoded_content()) ->
- (boolean() | {'error', any()})).
+-spec(is_message_persistent/1 ::
+ (decoded_content()) -> (boolean() | {'invalid', non_neg_integer()})).
-endif.
@@ -98,7 +98,7 @@ message(ExchangeName, RoutingKeyBin, RawProperties, BodyBin) ->
Properties = properties(RawProperties),
Content = build_content(Properties, BodyBin),
case is_message_persistent(Content) of
- {error, Other} ->
+ {invalid, Other} ->
{error, {invalid_delivery_mode, Other}};
Boolean when is_boolean(Boolean) ->
#basic_message{exchange_name = ExchangeName,
@@ -147,5 +147,5 @@ is_message_persistent(#content{properties = #'P_basic'{
1 -> false;
2 -> true;
undefined -> false;
- Other -> {error, Other}
+ Other -> {invalid, Other}
end.
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 4ab9f4cb..a96af292 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -1013,10 +1013,11 @@ notify_limiter(LimiterPid, Acked) ->
is_message_persistent(Content) ->
case rabbit_basic:is_message_persistent(Content) of
- {error, Other} ->
+ {invalid, Other} ->
rabbit_log:warning("Unknown delivery mode ~p - "
"treating as 1, non-persistent~n",
- [Other]);
+ [Other]),
+ false;
Boolean when is_boolean(Boolean) ->
Boolean
end.