diff --git a/Source/IO/AuIOPipeProcessor.cpp b/Source/IO/AuIOPipeProcessor.cpp index e2712cef..9eefeaca 100644 --- a/Source/IO/AuIOPipeProcessor.cpp +++ b/Source/IO/AuIOPipeProcessor.cpp @@ -127,19 +127,22 @@ namespace Aurora::IO if (this->pAsyncTransaction_) { - auto pWaitable = this->pAsyncAdapter_->ToWaitable(); - if (pWaitable) + if (!this->bShouldBypassIOWatch) { - ret = this->parent_->parent_->StartIOWatch(pWaitable, AuSharedFromThis()); - if (!ret) + auto pWaitable = this->pAsyncAdapter_->ToWaitable(); + if (pWaitable) + { + ret = this->parent_->parent_->StartIOWatch(pWaitable, AuSharedFromThis()); + if (!ret) + { + return false; + } + } + else { return false; } } - else - { - return false; - } } else { diff --git a/Source/IO/AuIOPipeProcessor.hpp b/Source/IO/AuIOPipeProcessor.hpp index 58b20c1b..cd2003a1 100644 --- a/Source/IO/AuIOPipeProcessor.hpp +++ b/Source/IO/AuIOPipeProcessor.hpp @@ -103,7 +103,8 @@ namespace Aurora::IO AuMemoryViewWrite nextWriteAsync_; IOPipeRequest request {}; - bool bShouldReadNext {false}; + bool bShouldReadNext { false }; + bool bShouldBypassIOWatch { false }; bool IsAtRequestedEnd(); AuByteBuffer *GetBuffer(); diff --git a/Source/IO/FS/Async.NT.cpp b/Source/IO/FS/Async.NT.cpp index cd1570bf..130da925 100644 --- a/Source/IO/FS/Async.NT.cpp +++ b/Source/IO/FS/Async.NT.cpp @@ -598,8 +598,6 @@ namespace Aurora::IO::FS { DWORD read {}; - this->dwLastAbstractStat = 0; - if (this->isIrredeemable_) { ::ResetEvent(this->event); diff --git a/Source/IO/Net/AuNetSocketChannelInput.cpp b/Source/IO/Net/AuNetSocketChannelInput.cpp index b01b866b..3622d554 100644 --- a/Source/IO/Net/AuNetSocketChannelInput.cpp +++ b/Source/IO/Net/AuNetSocketChannelInput.cpp @@ -99,11 +99,7 @@ namespace Aurora::IO::Net return; } - if (!pReader->Start()) - { - this->pParent_->SendErrorNoStream({}); - return; - } + AuStaticCast(pReader)->bShouldBypassIOWatch = true; auto pTX = this->pNetReadTransaction; if (!pTX) @@ -112,7 +108,14 @@ namespace Aurora::IO::Net return; } - pTX->SetCallback(sharedThis);//; AuSPtr(this->pParent_->SharedFromThis(), this)); + pTX->SetCallback(sharedThis); + + if (!pReader->Start()) + { + this->pParent_->SendErrorNoStream({}); + return; + } + IncrementWorker(); } diff --git a/Source/IO/Net/AuNetStream.NT.cpp b/Source/IO/Net/AuNetStream.NT.cpp index 8ae0c1a2..16fedd80 100644 --- a/Source/IO/Net/AuNetStream.NT.cpp +++ b/Source/IO/Net/AuNetStream.NT.cpp @@ -434,7 +434,8 @@ namespace Aurora::IO::Net bool NtAsyncNetworkTransaction::HasCompleted() { return this->bHasFailed || - this->dwLastBytes; + this->dwLastBytes || + this->bLatch; } AuUInt NtAsyncNetworkTransaction::GetOSErrorCode() @@ -461,18 +462,24 @@ namespace Aurora::IO::Net { AuLoop::ILSEvent *optEvent {}; - if (auto pLoopSource = this->pCompletionGroup_->GetTriggerLoopSource()) + if (auto pCompletionGroup = this->pCompletionGroup_) { - return pLoopSource; - } - else - { - if (auto pWaitable = this->pWaitable) + if (auto pLoopSource = pCompletionGroup->GetTriggerLoopSource()) { - return pWaitable; + return pLoopSource; } } + if (auto pWaitable = this->pWaitable) + { + return pWaitable; + } + + if (auto pSocket = this->pSocket) + { + return AuStaticCast(pSocket->ToWorkerEx()->ToEvent()); + } + return {}; }