diff --git a/src/ca/comQueSend.cpp b/src/ca/comQueSend.cpp index 1f3a02f09..cf4e1f9ef 100644 --- a/src/ca/comQueSend.cpp +++ b/src/ca/comQueSend.cpp @@ -88,6 +88,20 @@ void comQueSend::clear () assert ( this->nBytesPending == 0 ); } +void comQueSend::clearUncommitted () +{ + while ( this->pFirstUncommited.valid() ) { + tsDLIterBD < comBuf > next = this->pFirstUncommited; + next++; + this->pFirstUncommited->clearUncommittedIncomming (); + if ( this->pFirstUncommited->occupiedBytes() == 0u ) { + this->bufs.remove ( *this->pFirstUncommited ); + this->pFirstUncommited->destroy (); + } + this->pFirstUncommited = next; + } +} + void comQueSend::copy_dbr_string ( const void *pValue, unsigned nElem ) { this->copyIn ( static_cast ( pValue ), nElem ); diff --git a/src/ca/comQueSend.h b/src/ca/comQueSend.h index 9a75b1fe8..447b26092 100644 --- a/src/ca/comQueSend.h +++ b/src/ca/comQueSend.h @@ -61,12 +61,14 @@ private: const void *pValue, unsigned nElem ); static const copyFunc_t dbrCopyVector [39]; + void clearUncommitted (); + // // visual C++ version 6.0 does not allow out of // class member template function definition // template < class T > - inline void copyIn ( const T *pVal, unsigned nElem ) + inline void copyIn ( const T *pVal, const unsigned nElem ) { comBuf * pLastBuf = this->bufs.last (); unsigned nCopied; @@ -173,14 +175,8 @@ inline bool comQueSend::flushEarlyThreshold ( unsigned nBytesThisMsg ) const inline void comQueSend::beginMsg () { - while ( this->pFirstUncommited.valid() ) { - tsDLIterBD < comBuf > next = this->pFirstUncommited; - next++; - this->pFirstUncommited->clearUncommittedIncomming (); - if ( this->pFirstUncommited->occupiedBytes() == 0u ) { - this->bufs.remove ( *this->pFirstUncommited ); - } - this->pFirstUncommited = next; + if ( this->pFirstUncommited.valid() ) { + this->clearUncommitted (); } this->pFirstUncommited = this->bufs.lastIter (); }