[*] precache socket network state errors here before the last transaction is released

This commit is contained in:
Reece Wilson 2023-04-27 10:44:15 +01:00
parent eb4ee3143d
commit f8219542c5

View File

@ -121,8 +121,12 @@ namespace Aurora::IO::Net
void SocketChannelInput::OnPipeSuccessEvent()
{
this->pParent_->SendEnd();
DecrementWorker();
// precache error or shutdown code before the last read transaction is lost
(void)this->pParent_->GetError();
this->pParent_->SendEnd();
this->pNetReader.reset();
this->pNetReadTransaction.reset();
}
@ -132,6 +136,8 @@ namespace Aurora::IO::Net
NetError error;
bool bSetError {};
DecrementWorker();
if (this->pNetReadTransaction)
{
if (this->pNetReadTransaction->Failed())
@ -139,6 +145,16 @@ namespace Aurora::IO::Net
NetError_SetOsError(error, this->pNetReadTransaction->GetOSErrorCode());
bSetError = true;
}
else
{
// precache error or shutdown code before the last read transaction is lost
(void)this->pParent_->GetError();
}
}
else
{
// precache error or shutdown code before the last read transaction is lost
(void)this->pParent_->GetError();
}
if (!bSetError)
@ -148,7 +164,6 @@ namespace Aurora::IO::Net
this->pParent_->SendErrorNoStream(error);
DecrementWorker();
this->pNetReader.reset();
this->pNetReadTransaction.reset();
}