Index: src/libchcore/TFilesystemFileFeedbackWrapper.h =================================================================== diff -u -r789d0908abf8db57e27cfeac7045d9962f4b522a -re7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf --- src/libchcore/TFilesystemFileFeedbackWrapper.h (.../TFilesystemFileFeedbackWrapper.h) (revision 789d0908abf8db57e27cfeac7045d9962f4b522a) +++ src/libchcore/TFilesystemFileFeedbackWrapper.h (.../TFilesystemFileFeedbackWrapper.h) (revision e7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf) @@ -55,6 +55,7 @@ file_size_t GetSeekPositionForResume(file_size_t fsLastAvailablePosition) { return m_spFile->GetSeekPositionForResume(fsLastAvailablePosition); } bool IsOpen() const { return m_spFile->IsOpen(); } + void Close() { m_spFile->Close(); } private: bool WasKillRequested(const TFeedbackResult& rFeedbackResult) const; Index: src/libchcore/TOverlappedReaderFB.cpp =================================================================== diff -u -r980c1a0de537813728871676200a0960410b11fb -re7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf --- src/libchcore/TOverlappedReaderFB.cpp (.../TOverlappedReaderFB.cpp) (revision 980c1a0de537813728871676200a0960410b11fb) +++ src/libchcore/TOverlappedReaderFB.cpp (.../TOverlappedReaderFB.cpp) (revision e7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf) @@ -85,7 +85,10 @@ bool bSkip = false; TSubTaskBase::ESubOperationResult eResult = m_spSrcFile->HandleReadError(*pBuffer, bSkip); if(eResult == TSubTaskBase::eSubResult_Retry) + { + m_spSrcFile->Close(); m_spReader->AddEmptyBuffer(pBuffer, true); + } else if(eResult != TSubTaskBase::eSubResult_Continue) { m_spReader->AddEmptyBuffer(pBuffer, false); Index: src/libchcore/TOverlappedWriter.cpp =================================================================== diff -u -rb941384e121190b6107f1c99b3233667e3daf4ce -re7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf --- src/libchcore/TOverlappedWriter.cpp (.../TOverlappedWriter.cpp) (revision b941384e121190b6107f1c99b3233667e3daf4ce) +++ src/libchcore/TOverlappedWriter.cpp (.../TOverlappedWriter.cpp) (revision e7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf) @@ -44,6 +44,27 @@ { } + void TOverlappedWriter::AddRetryBuffer(TOverlappedDataBuffer* pBuffer) + { + if(!pBuffer) + throw TCoreException(eErr_InvalidPointer, L"pBuffer", LOCATION); + + if(m_bReleaseMode) + m_spEmptyBuffers->Push(pBuffer); + else + { + LOG_TRACE(m_spLog) << L"Queuing buffer " << pBuffer << L" as write-retry; buffer-order: " << pBuffer->GetFilePosition() << + L", requested-data-size: " << pBuffer->GetRequestedDataSize() << + L", real-data-size: " << pBuffer->GetRealDataSize() << + L", file-position: " << pBuffer->GetFilePosition() << + L", error-code: " << pBuffer->GetErrorCode() << + L", status-code: " << pBuffer->GetStatusCode() << + L", is-last-part: " << pBuffer->IsLastPart(); + + m_tBuffersToWrite.Push(pBuffer); + } + } + TOverlappedDataBuffer* TOverlappedWriter::GetWriteBuffer() { if(m_bReleaseMode) @@ -73,9 +94,6 @@ L", status-code: " << pBuffer->GetStatusCode() << L", is-last-part: " << pBuffer->IsLastPart(); - // overwrite error code (to avoid treating the buffer as failed read) - pBuffer->SetErrorCode(ERROR_SUCCESS); - m_tFinishedBuffers.PushError(pBuffer, m_tBuffersToWrite); } } Index: src/libchcore/TOverlappedWriter.h =================================================================== diff -u -rb941384e121190b6107f1c99b3233667e3daf4ce -re7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf --- src/libchcore/TOverlappedWriter.h (.../TOverlappedWriter.h) (revision b941384e121190b6107f1c99b3233667e3daf4ce) +++ src/libchcore/TOverlappedWriter.h (.../TOverlappedWriter.h) (revision e7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf) @@ -37,6 +37,7 @@ TOverlappedWriter& operator=(const TOverlappedWriter&) = delete; + void AddRetryBuffer(TOverlappedDataBuffer* pBuffer); TOverlappedDataBuffer* GetWriteBuffer(); // buffer management - writer Index: src/libchcore/TOverlappedWriterFB.cpp =================================================================== diff -u -r980c1a0de537813728871676200a0960410b11fb -re7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf --- src/libchcore/TOverlappedWriterFB.cpp (.../TOverlappedWriterFB.cpp) (revision 980c1a0de537813728871676200a0960410b11fb) +++ src/libchcore/TOverlappedWriterFB.cpp (.../TOverlappedWriterFB.cpp) (revision e7ca9e2c6306cd94e5e5caecc9cfdb3b562d3cdf) @@ -97,7 +97,10 @@ bool bSkip = false; TSubTaskBase::ESubOperationResult eResult = m_spDstFile->HandleWriteError(*pBuffer, bSkip); if(eResult == TSubTaskBase::eSubResult_Retry) - m_spWriter->AddFailedWriteBuffer(pBuffer); + { + m_spDstFile->Close(); + m_spWriter->AddRetryBuffer(pBuffer); + } else if(eResult != TSubTaskBase::eSubResult_Continue) { m_spEmptyBuffers->Push(pBuffer);