[*] More IO bug fixes; a double free, statement that should be uncommented, and wrong IO handle under Async.NT.cpp read
This commit is contained in:
parent
ee07505952
commit
c0ee48435c
@ -18,7 +18,7 @@ namespace Aurora::IO::FS
|
||||
{
|
||||
struct NtAsyncFileTransactionLoopSource : AuLoop::LSHandle
|
||||
{
|
||||
NtAsyncFileTransactionLoopSource(AuSPtr<NtAsyncFileTransaction> that) : caller_(that), Loop::LSHandle(AuUInt(that->GetFileHandle()->handle))
|
||||
NtAsyncFileTransactionLoopSource(AuSPtr<NtAsyncFileTransaction> that) : caller_(that), Loop::LSHandle(AuUInt(that->event_))
|
||||
{}
|
||||
|
||||
virtual bool IsSignaled() override;
|
||||
@ -273,6 +273,7 @@ namespace Aurora::IO::FS
|
||||
|
||||
hold->lastAbstractStat_ = 0;
|
||||
hold->CompleteEx(dwNumberOfBytesTransfered);
|
||||
hold->memoryHold_.reset();
|
||||
}
|
||||
|
||||
bool NtAsyncFileTransaction::IDontWannaUsePorts()
|
||||
@ -379,14 +380,11 @@ namespace Aurora::IO::FS
|
||||
|
||||
this->lastBytes = read;
|
||||
|
||||
auto memoryHold = this->memoryHold_;
|
||||
|
||||
if (this->sub_)
|
||||
{
|
||||
this->sub_->OnAsyncFileOpFinished(this->lastAbstractOffset_, read);
|
||||
}
|
||||
|
||||
this->memoryHold_.reset();
|
||||
}
|
||||
|
||||
void NtAsyncFileTransaction::Reset()
|
||||
@ -411,7 +409,7 @@ namespace Aurora::IO::FS
|
||||
|
||||
bool NtAsyncFileTransaction::Failed()
|
||||
{
|
||||
return this->hasFailed && this->osErrorCode != ERROR_BROKEN_PIPE;
|
||||
return this->hasFailed;
|
||||
}
|
||||
|
||||
AuUInt NtAsyncFileTransaction::GetOSErrorCode()
|
||||
|
@ -34,6 +34,7 @@ namespace Aurora::IO
|
||||
~AsyncStreamMemory();
|
||||
|
||||
bool IsValid();
|
||||
bool owned {};
|
||||
AuSPtr<AuMemoryViewWrite> pin;
|
||||
AuUInt streamIndex {};
|
||||
// todo shared
|
||||
@ -116,12 +117,12 @@ namespace Aurora::IO
|
||||
|
||||
AsyncStreamMemory::AsyncStreamMemory(AuUInt length) : AuMemoryViewWrite(AuMemory::ZAlloc<AuUInt8*>(length), length)
|
||||
{
|
||||
|
||||
this->owned = true;
|
||||
}
|
||||
|
||||
AsyncStreamMemory::~AsyncStreamMemory()
|
||||
{
|
||||
if (this->ptr)
|
||||
if (this->ptr && this->owned)
|
||||
{
|
||||
AuMemory::Free(this->ptr);
|
||||
this->ptr = nullptr;
|
||||
|
@ -328,7 +328,7 @@ namespace Aurora::IO
|
||||
try
|
||||
{
|
||||
AuUInt canBuffer = this->buffer_.RemainingWrite();
|
||||
//canBuffer = AuMin(canBuffer, AuUInt((this->buffer_.length + this->buffer_.base) - this->buffer_.writePtr));
|
||||
canBuffer = AuMin(canBuffer, AuUInt((this->buffer_.length + this->buffer_.base) - this->buffer_.writePtr));
|
||||
|
||||
this->nextWriteAsync_ = AuMemoryViewWrite(this->buffer_.writePtr, canBuffer);
|
||||
|
||||
@ -373,7 +373,16 @@ namespace Aurora::IO
|
||||
do
|
||||
{
|
||||
AuUInt canRead = this->buffer_.RemainingBytes();
|
||||
if (!canRead)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
canRead = AuMin<AuUInt>(canRead, (this->buffer_.length + this->buffer_.base) - this->buffer_.readPtr);
|
||||
if (!canRead)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user