Skip to content

Commit 0d357f0

Browse files
author
Michael Bennett
committed
Fix stale delivery tags in RecoveryAwareModel
RecoveryAwareModel was attempting to prevent acking of stale delivery tags by checking if the un-adjusted tag was > 0. However, the tag is a ulong, not a long, so it will always be >= 0. This change compares the un-adjusted tag to the adjusted tag to ensure it hasn't wrapped around to a higher number.
1 parent 4a45e6e commit 0d357f0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

projects/client/RabbitMQ.Client/src/client/impl/RecoveryAwareModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public override void BasicAck(ulong deliveryTag,
8686
bool multiple)
8787
{
8888
ulong realTag = deliveryTag - ActiveDeliveryTagOffset;
89-
if (realTag > 0)
89+
if (realTag > 0 && realTag <= deliveryTag)
9090
{
9191
base.BasicAck(realTag, multiple);
9292
}
@@ -97,7 +97,7 @@ public override void BasicNack(ulong deliveryTag,
9797
bool requeue)
9898
{
9999
ulong realTag = deliveryTag - ActiveDeliveryTagOffset;
100-
if (realTag > 0)
100+
if (realTag > 0 && realTag <= deliveryTag)
101101
{
102102
base.BasicNack(realTag, multiple, requeue);
103103
}
@@ -107,7 +107,7 @@ public override void BasicReject(ulong deliveryTag,
107107
bool requeue)
108108
{
109109
ulong realTag = deliveryTag - ActiveDeliveryTagOffset;
110-
if (realTag > 0)
110+
if (realTag > 0 && realTag <= deliveryTag)
111111
{
112112
base.BasicReject(realTag, requeue);
113113
}

0 commit comments

Comments
 (0)