Simplify message counter logic
This commit is contained in:
parent
061c462ee0
commit
3ab9eed268
|
|
@ -137,8 +137,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return number of messages sent.
|
* Return number of messages sent.
|
||||||
*
|
*
|
||||||
* This functions returns number of messages sent. It's incremented only
|
* This functions returns number of messages sent. It's reset to zero when channel is
|
||||||
* when channel is in confirm mode.
|
* put into confirm mode.
|
||||||
*/
|
*/
|
||||||
uint64_t messageCounter() const
|
uint64_t messageCounter() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -764,11 +764,11 @@ public:
|
||||||
void complete();
|
void complete();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start message counter
|
* Reset message counter
|
||||||
*/
|
*/
|
||||||
void startMessageCounter()
|
void resetMessageCounter()
|
||||||
{
|
{
|
||||||
_messageCounter = 1;
|
_messageCounter = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -505,8 +505,7 @@ bool ChannelImpl::publish(const std::string &exchange, const std::string &routin
|
||||||
bytesleft -= chunksize;
|
bytesleft -= chunksize;
|
||||||
}
|
}
|
||||||
|
|
||||||
// increment message counter if we're in confirm mode
|
// increment message counter
|
||||||
if (_messageCounter)
|
|
||||||
_messageCounter++;
|
_messageCounter++;
|
||||||
|
|
||||||
// done
|
// done
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,8 @@ public:
|
||||||
// channel does not exist
|
// channel does not exist
|
||||||
if(!channel) return false;
|
if(!channel) return false;
|
||||||
|
|
||||||
// start message counter
|
// reset message counter
|
||||||
channel->startMessageCounter();
|
channel->resetMessageCounter();
|
||||||
|
|
||||||
// report that the channel is open
|
// report that the channel is open
|
||||||
if (channel->reportSuccess()) channel->onSynchronized();
|
if (channel->reportSuccess()) channel->onSynchronized();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue