[*] AuNet: Missing Linux TODO block; harden two callbacks missing a try/catch

This commit is contained in:
Reece Wilson 2024-07-01 11:54:18 +01:00
parent 3bae761e50
commit 592afe00a7
6 changed files with 47 additions and 5 deletions

View File

@ -18,6 +18,8 @@
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
#include "AuNetStream.NT.hpp" #include "AuNetStream.NT.hpp"
#else
#include "AuNetStream.Linux.hpp"
#endif #endif
namespace Aurora::IO::Net namespace Aurora::IO::Net
@ -694,9 +696,18 @@ namespace Aurora::IO::Net
this->socketChannel_.outputChannel.pParent_ = nullptr; this->socketChannel_.outputChannel.pParent_ = nullptr;
#else #else
// TODO: if (this->socketChannel_.inputChannel.pNetReadTransaction)
#endif {
AuStaticCast<LinuxAsyncNetworkTransaction>(this->socketChannel_.inputChannel.pNetReadTransaction)->pSocket = nullptr;
}
this->socketChannel_.inputChannel.pNetReadTransaction.reset();
if (pWriteTransaction)
{
AuStaticCast<LinuxAsyncNetworkTransaction>(pWriteTransaction)->pSocket = nullptr;
}
#endif
this->CloseSocket(); this->CloseSocket();
} }

View File

@ -585,6 +585,11 @@ namespace Aurora::IO::Net
{ {
this->StopTime(); this->StopTime();
if (this->inputChannel.pNetReader)
{
this->inputChannel.pNetReader->End();
}
this->PrivateUserDataClear(); this->PrivateUserDataClear();
this->pCachedReader.reset(); this->pCachedReader.reset();

View File

@ -79,7 +79,6 @@ namespace Aurora::IO::Net
void SocketChannelInput::WarmOnEstablish() void SocketChannelInput::WarmOnEstablish()
{ {
auto sharedThis = AuSPtr<SocketChannelInput>(this->pParent_->SharedFromThis(), this); auto sharedThis = AuSPtr<SocketChannelInput>(this->pParent_->SharedFromThis(), this);
AuIO::IOPipeRequestAIO req; AuIO::IOPipeRequestAIO req;
req.output.handleBufferedStream.pOnData = AuUnsafeRaiiToShared(this); req.output.handleBufferedStream.pOnData = AuUnsafeRaiiToShared(this);
req.output.type = EPipeCallbackType::eTryHandleBufferedPart; req.output.type = EPipeCallbackType::eTryHandleBufferedPart;

View File

@ -69,6 +69,11 @@ namespace Aurora::IO::Net
const AuSPtr<INetWorker> &pWorker) const AuSPtr<INetWorker> &pWorker)
{ {
this->pSocket = that; this->pSocket = that;
if (!this->pEvent)
{
return false;
}
auto bStatus = pWorker->ToProcessor()->StartSimpleLSWatchEx(this->pEvent, auto bStatus = pWorker->ToProcessor()->StartSimpleLSWatchEx(this->pEvent,
AuSPtr<AuIO::IIOSimpleEventListener>(that, this), AuSPtr<AuIO::IIOSimpleEventListener>(that, this),
true); true);

View File

@ -379,9 +379,24 @@ namespace Aurora::IO::Net
} }
if (this->pSub) if (this->pSub)
{
try
{ {
this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read); this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
} }
catch (...)
{
SysPushErrorCatch();
}
}
if (!read)
{
if (this->pSocket)
{
this->pSocket->SendEnd();
}
}
} }
int LinuxAsyncNetworkTransaction::GetSocket() int LinuxAsyncNetworkTransaction::GetSocket()

View File

@ -550,9 +550,16 @@ namespace Aurora::IO::Net
} }
if (this->pSub) if (this->pSub)
{
try
{ {
this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read); this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
} }
catch (...)
{
SysPushErrorCatch();
}
}
} }
SOCKET NtAsyncNetworkTransaction::GetSocket() SOCKET NtAsyncNetworkTransaction::GetSocket()