diff --git a/include/channel.h b/include/channel.h index bb51b8e..839ca02 100644 --- a/include/channel.h +++ b/include/channel.h @@ -137,8 +137,8 @@ public: /** * Return number of messages sent. * - * This functions returns number of messages sent. It's incremented only - * when channel is in confirm mode. + * This functions returns number of messages sent. It's reset to zero when channel is + * put into confirm mode. */ uint64_t messageCounter() const { diff --git a/include/channelimpl.h b/include/channelimpl.h index 9267bc0..6770022 100644 --- a/include/channelimpl.h +++ b/include/channelimpl.h @@ -764,11 +764,11 @@ public: void complete(); /** - * Start message counter + * Reset message counter */ - void startMessageCounter() + void resetMessageCounter() { - _messageCounter = 1; + _messageCounter = 0; } /** diff --git a/src/channelimpl.cpp b/src/channelimpl.cpp index dde08af..11ec906 100644 --- a/src/channelimpl.cpp +++ b/src/channelimpl.cpp @@ -505,9 +505,8 @@ bool ChannelImpl::publish(const std::string &exchange, const std::string &routin bytesleft -= chunksize; } - // increment message counter if we're in confirm mode - if (_messageCounter) - _messageCounter++; + // increment message counter + _messageCounter++; // done return true; diff --git a/src/confirmselectokframe.h b/src/confirmselectokframe.h index 83ee8b8..098168b 100644 --- a/src/confirmselectokframe.h +++ b/src/confirmselectokframe.h @@ -74,8 +74,8 @@ public: // channel does not exist if(!channel) return false; - // start message counter - channel->startMessageCounter(); + // reset message counter + channel->resetMessageCounter(); // report that the channel is open if (channel->reportSuccess()) channel->onSynchronized();