[*] 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)
#include "AuNetStream.NT.hpp"
#else
#include "AuNetStream.Linux.hpp"
#endif
namespace Aurora::IO::Net
@ -694,9 +696,18 @@ namespace Aurora::IO::Net
this->socketChannel_.outputChannel.pParent_ = nullptr;
#else
// TODO:
#endif
if (this->socketChannel_.inputChannel.pNetReadTransaction)
{
AuStaticCast<LinuxAsyncNetworkTransaction>(this->socketChannel_.inputChannel.pNetReadTransaction)->pSocket = nullptr;
}
this->socketChannel_.inputChannel.pNetReadTransaction.reset();
if (pWriteTransaction)
{
AuStaticCast<LinuxAsyncNetworkTransaction>(pWriteTransaction)->pSocket = nullptr;
}
#endif
this->CloseSocket();
}

View File

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

View File

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

View File

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

View File

@ -380,7 +380,22 @@ namespace Aurora::IO::Net
if (this->pSub)
{
this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
try
{
this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
}
catch (...)
{
SysPushErrorCatch();
}
}
if (!read)
{
if (this->pSocket)
{
this->pSocket->SendEnd();
}
}
}

View File

@ -551,7 +551,14 @@ namespace Aurora::IO::Net
if (this->pSub)
{
this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
try
{
this->pSub->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
}
catch (...)
{
SysPushErrorCatch();
}
}
}