Skip to content

Commit fcfe0da

Browse files
committed
better var/method naming for confirm sequence number
also start count at 1 not 0 since the latter has a special meaning in basic.ack
1 parent eacdb8b commit fcfe0da

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

projects/client/RabbitMQ.Client/src/client/api/IModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ public interface IModel: IDisposable
143143
///== null.</summary>
144144
bool IsOpen { get; }
145145

146-
///<summary>Returns the number of messages published since the
147-
///channel was put in confirm mode.</summary>
148-
ulong? PublishedMessageCount { get; }
146+
///<summary>Returns the sequence number of the next message to be published that requires confirmation. 0 if we are not in confirm mode.
147+
///</summary>
148+
ulong NextPublishSeqNo { get; }
149149

150150
///<summary>Construct a completely empty content header for
151151
///use with the Basic content class.</summary>

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public abstract class ModelBase : IFullModel
8989
public ManualResetEvent m_flowControlBlock = new ManualResetEvent(true);
9090
private readonly object m_flowSendLock = new object();
9191

92-
private ulong? m_pubMsgCount = null;
92+
private ulong m_nextPubSeqNo;
9393

9494
public event ModelShutdownEventHandler ModelShutdown
9595
{
@@ -458,11 +458,11 @@ public bool IsOpen
458458
}
459459
}
460460

461-
public ulong? PublishedMessageCount
461+
public ulong NextPublishSeqNo
462462
{
463463
get
464464
{
465-
return m_pubMsgCount;
465+
return m_nextPubSeqNo;
466466
}
467467
}
468468

@@ -753,7 +753,7 @@ public void ConfirmSelect() {
753753
}
754754

755755
public void ConfirmSelect(bool nowait) {
756-
m_pubMsgCount = 0;
756+
m_nextPubSeqNo = 1;
757757
_Private_ConfirmSelect(nowait);
758758
}
759759

@@ -994,8 +994,7 @@ public void BasicPublish(string exchange,
994994
{
995995
basicProperties = CreateBasicProperties();
996996
}
997-
if (m_pubMsgCount.HasValue)
998-
m_pubMsgCount++;
997+
if (m_nextPubSeqNo > 0) m_nextPubSeqNo++;
999998
_Private_BasicPublish(exchange,
1000999
routingKey,
10011000
mandatory,

0 commit comments

Comments
 (0)