[*] I'm a dumbass. This was accounted for a long ass time ago

This commit is contained in:
Reece Wilson 2022-06-29 20:37:32 +01:00
parent bc1296a35c
commit f8c45613a1

View File

@ -258,16 +258,20 @@ namespace Aurora::IO::FS
auto transaction = reinterpret_cast<NtAsyncFileTransaction *>(reinterpret_cast<AuUInt8*>(lpOverlapped) - offsetof(NtAsyncFileTransaction, overlap_)); auto transaction = reinterpret_cast<NtAsyncFileTransaction *>(reinterpret_cast<AuUInt8*>(lpOverlapped) - offsetof(NtAsyncFileTransaction, overlap_));
auto hold = AuExchange(transaction->pin_, {}); auto hold = AuExchange(transaction->pin_, {});
SetEvent(lpOverlapped->hEvent);
if (dwErrorCode) if (dwErrorCode)
{ {
hold->hasFailed = true; hold->hasFailed = true;
hold->osErrorCode = dwErrorCode; hold->osErrorCode = dwErrorCode;
} }
else if (!hold->lastAbstractStat_)
{
return;
}
SetEvent(lpOverlapped->hEvent);
hold->lastAbstractStat_ = 0; hold->lastAbstractStat_ = 0;
hold->CompleteEx(dwNumberOfBytesTransfered); hold->CompleteEx(dwNumberOfBytesTransfered);
} }
@ -428,9 +432,6 @@ namespace Aurora::IO::FS
if (!completeRoutine) if (!completeRoutine)
{ {
// TODO: only preempt the callback handler if we aren't racing reuse
// Could bypass with a while (ioyield()) under such race condition
#if 0
if (this->GetOSErrorCode() == ERROR_BROKEN_PIPE) if (this->GetOSErrorCode() == ERROR_BROKEN_PIPE)
{ {
auto pipe = this->ntIpcPipeImpl.lock(); auto pipe = this->ntIpcPipeImpl.lock();
@ -448,12 +449,11 @@ namespace Aurora::IO::FS
if ((this->hasFailed) || if ((this->hasFailed) ||
::GetOverlappedResult(this->handle_->handle, &this->overlap_, &read, false)) ::GetOverlappedResult(this->handle_->handle, &this->overlap_, &read, false))
{ {
this->lastAbstractStat_ = 0;
bool bLatched = this->latch_; bool bLatched = this->latch_;
DispatchCb(read); DispatchCb(read);
return this->hasFailed || read; return this->hasFailed || read;
} }
#endif
return this->lastBytes || this->hasFailed;
} }
else else
{ {