Index: src/libchcore/TOrderedBufferQueue.h =================================================================== diff -u -N -rb941384e121190b6107f1c99b3233667e3daf4ce -r685d0da3259dd94327ee8d644a88c155585b8249 --- src/libchcore/TOrderedBufferQueue.h (.../TOrderedBufferQueue.h) (revision b941384e121190b6107f1c99b3233667e3daf4ce) +++ src/libchcore/TOrderedBufferQueue.h (.../TOrderedBufferQueue.h) (revision 685d0da3259dd94327ee8d644a88c155585b8249) @@ -57,7 +57,6 @@ boost::signals2::signal& GetNotifier(); private: - bool IsBufferReady() const; void UpdateHasBuffers(); void UpdateHasErrors(); @@ -79,6 +78,8 @@ template void TOrderedBufferQueue::PushError(TOverlappedDataBuffer* pBuffer, T& rRetryQueue) { + if(!pBuffer) + throw TCoreException(eErr_InvalidArgument, L"pBuffer is NULL", LOCATION); if(!pBuffer->HasError()) throw TCoreException(eErr_InvalidArgument, L"Cannot push successful buffer to failed queue", LOCATION); @@ -92,13 +93,22 @@ if(pBuffer->GetFilePosition() < m_ullErrorPosition) { - rRetryQueue.Push(m_pFirstErrorBuffer, true); + if(m_pFirstErrorBuffer) + { + // if there is no ptr set then it is being processed somewhere and will be handled separately + m_pFirstErrorBuffer->SetErrorCode(ERROR_SUCCESS); + rRetryQueue.Push(m_pFirstErrorBuffer, true); + } m_pFirstErrorBuffer = pBuffer; m_ullErrorPosition = pBuffer->GetFilePosition(); } else if(pBuffer->GetFilePosition() > m_ullErrorPosition) + { + pBuffer->SetErrorCode(ERROR_SUCCESS); rRetryQueue.Push(pBuffer, true); - // else encountered error at the same position as before + } + else if(!m_pFirstErrorBuffer) + m_pFirstErrorBuffer = pBuffer; // restore the buffer UpdateHasErrors(); }