summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-11 14:01:16 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2010-08-11 14:01:16 +0100
commit91d12163db8232a8c1e2b16c81e21bdab0e04e27 (patch)
tree541a315202abfd5e5c96fb5ce347ca223b5b8eeb
parent5cc92b64e688ba403233eff17fcfbdf3d1460431 (diff)
downloadrabbitmq-server-git-91d12163db8232a8c1e2b16c81e21bdab0e04e27.tar.gz
check that messages are transient before ack'ing blindly
-rw-r--r--src/rabbit_channel.erl10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 38c4855020..d06b7a3040 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -395,14 +395,14 @@ queue_blocked(QPid, State = #ch{blocking = Blocking}) ->
State#ch{blocking = Blocking1}
end.
-handle_pubAck(PA = #pubAck{ enabled = false }, _) ->
+handle_pubAck(PA = #pubAck{ enabled = false }, _, _) ->
PA;
-handle_pubAck(PA = #pubAck{ count = Count, many = false }, WriterPid) ->
+handle_pubAck(PA = #pubAck{ count = Count, many = false }, false, WriterPid) ->
rabbit_log:info("handling pubAck in single mode (#~p)~n", [Count]),
ok = rabbit_writer:send_command(WriterPid, #'basic.ack'{ delivery_tag = Count }),
PA#pubAck{ count = Count+1 };
-handle_pubAck(PA = #pubAck{ count = Count }, _WriterPid) ->
- rabbit_log:info("handling pubAck in many mode (#~p)~n", [Count]),
+handle_pubAck(PA = #pubAck{ count = Count }, IsPersistent, _WriterPid) ->
+ rabbit_log:info("handling pubAck (#~p, persistent = ~p)~n", [Count, IsPersistent]),
PA#pubAck{ count = Count+1 }.
handle_method(#'channel.open'{}, _, State = #ch{state = starting}) ->
@@ -434,11 +434,11 @@ handle_method(#'basic.publish'{exchange = ExchangeNameBin,
ExchangeName = rabbit_misc:r(VHostPath, exchange, ExchangeNameBin),
check_write_permitted(ExchangeName, State),
Exchange = rabbit_exchange:lookup_or_die(ExchangeName),
- PubAck1 = handle_pubAck(PubAck, WriterPid),
%% 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),
IsPersistent = is_message_persistent(DecodedContent),
+ PubAck1 = handle_pubAck(PubAck, IsPersistent, WriterPid),
Message = #basic_message{exchange_name = ExchangeName,
routing_key = RoutingKey,
content = DecodedContent,