[*] improved network error reporting
This commit is contained in:
parent
044fb5b7e4
commit
b8540c77a7
@ -32,6 +32,7 @@ namespace Aurora::IO::Net
|
||||
eEndpointRefused,
|
||||
eServiceRefused,
|
||||
eServiceTaken,
|
||||
eBrokenAIOPipe,
|
||||
eUnknown
|
||||
));
|
||||
}
|
@ -449,6 +449,15 @@ namespace Aurora::IO::Net
|
||||
|
||||
const NetError &SocketBase::GetError()
|
||||
{
|
||||
if (this->error_.netError == ENetworkError::kEnumInvalid)
|
||||
{
|
||||
if (this->socketChannel_.inputChannel.pNetReadTransaction &&
|
||||
this->socketChannel_.inputChannel.pNetReadTransaction->Failed())
|
||||
{
|
||||
NetError_SetOsError(this->error_, this->socketChannel_.inputChannel.pNetReadTransaction->GetOSErrorCode());
|
||||
}
|
||||
}
|
||||
|
||||
return this->error_;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "AuNetWorker.hpp"
|
||||
#include "AuNetSocketChannel.hpp"
|
||||
#include <Source/IO/AuIOPipeProcessor.hpp>
|
||||
#include "AuNetError.hpp"
|
||||
|
||||
namespace Aurora::IO::Net
|
||||
{
|
||||
@ -128,6 +129,25 @@ namespace Aurora::IO::Net
|
||||
|
||||
void SocketChannelInput::OnPipeFailureEvent()
|
||||
{
|
||||
NetError error;
|
||||
bool bSetError {};
|
||||
|
||||
if (this->pNetReadTransaction)
|
||||
{
|
||||
if (this->pNetReadTransaction->Failed())
|
||||
{
|
||||
NetError_SetOsError(error, this->pNetReadTransaction->GetOSErrorCode());
|
||||
bSetError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bSetError)
|
||||
{
|
||||
error = ENetworkError::eBrokenAIOPipe;
|
||||
}
|
||||
|
||||
this->pParent_->SendErrorNoStream(error);
|
||||
|
||||
DecrementWorker();
|
||||
this->pNetReader.reset();
|
||||
this->pNetReadTransaction.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user