[*] Improved disconnect reason reporting: HasErrorCode under the NT network async stream object
This commit is contained in:
parent
4b79aa902b
commit
efadd964be
@ -451,13 +451,25 @@ namespace Aurora::IO::Net
|
||||
{
|
||||
if (this->error_.netError == ENetworkError::kEnumInvalid)
|
||||
{
|
||||
// Note: some interfaces will now have a `HasErrorCode` that reports non-fatal errors
|
||||
// This should be useful for reporting the disconnect reason when otherwise filtered as not-an-error
|
||||
if (this->socketChannel_.inputChannel.pNetReadTransaction &&
|
||||
this->socketChannel_.inputChannel.pNetReadTransaction->Failed())
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
AuStaticCast<NtAsyncNetworkTransaction>(this->socketChannel_.inputChannel.pNetReadTransaction)->HasErrorCode()
|
||||
#else
|
||||
this->socketChannel_.inputChannel.pNetReadTransaction->Failed()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
NetError_SetOsError(this->error_, this->socketChannel_.inputChannel.pNetReadTransaction->GetOSErrorCode());
|
||||
}
|
||||
else if (this->socketChannel_.outputChannel.pNetWriteTransaction_ &&
|
||||
this->socketChannel_.outputChannel.pNetWriteTransaction_->Failed())
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
AuStaticCast<NtAsyncNetworkTransaction>(this->socketChannel_.outputChannel.pNetWriteTransaction_)->HasErrorCode()
|
||||
#else
|
||||
this->socketChannel_.outputChannel.pNetWriteTransaction_->Failed()
|
||||
#endif
|
||||
)
|
||||
{
|
||||
NetError_SetOsError(this->error_, this->socketChannel_.outputChannel.pNetWriteTransaction_->GetOSErrorCode());
|
||||
}
|
||||
|
@ -343,6 +343,12 @@ namespace Aurora::IO::Net
|
||||
this->dwOsErrorCode != WSAEDISCON;
|
||||
}
|
||||
|
||||
bool NtAsyncNetworkTransaction::HasErrorCode()
|
||||
{
|
||||
return this->bHasFailed &&
|
||||
this->dwOsErrorCode != ERROR_HANDLE_EOF;
|
||||
}
|
||||
|
||||
AuUInt NtAsyncNetworkTransaction::GetOSErrorCode()
|
||||
{
|
||||
return this->dwOsErrorCode;
|
||||
|
@ -29,6 +29,7 @@ namespace Aurora::IO::Net
|
||||
bool CompleteEx(AuUInt completeRoutine);
|
||||
|
||||
bool Failed() override;
|
||||
bool HasErrorCode();
|
||||
AuUInt GetOSErrorCode() override;
|
||||
|
||||
AuUInt32 GetLastPacketLength() override;
|
||||
|
Loading…
Reference in New Issue
Block a user