[*] Client teardown was kinda borked

This commit is contained in:
Reece Wilson 2022-07-08 04:30:03 +01:00
parent 14ebab9d22
commit 4508b07802
2 changed files with 9 additions and 3 deletions

View File

@ -54,6 +54,11 @@ AuSPtr<AuRPC> AuRPCClientChannel::ToContext()
void AuRPCClientChannel::OnDisconnect(bool error)
{
RpcLogDebug("AuRPCClientChannel::OnDisconnect");
if (this->bConnected_ || !this->bConnectingAlternate_)
{
Finalize();
}
}
bool AuRPCClientChannel::OnDataAvailable(AuByteBuffer &view)
@ -95,8 +100,8 @@ bool AuRPCClientChannel::OnDataAvailable(AuByteBuffer &view)
}
else if (packetType == kResponseMulticonnect)
{
this->pipe_.Deinit();
this->bConnectingAlternate_ = true;
this->pipe_.Deinit();
this->Init(view.Read<AuString>());
}
else if (packetType == kResponseRPC)
@ -214,5 +219,6 @@ void AuRPCClientChannel::Finalize()
if (this->callbacks_)
{
this->callbacks_->OnDisconnect();
this->callbacks_.reset();
}
}

View File

@ -156,8 +156,10 @@ void AuRPCPipe::OnPipeSuccessEvent()
{
if (this->isClient_)
{
OnError(false);
return;
}
RpcLogDebug("Waiting for next socket");
this->isOpenWork = GetRPCProcessor()->StartSimpleLSWatch(this->pipe->AsReadChannelIsOpen(),
AuSPtr<AuIO::IIOSimpleEventListener>(this->channel->ToContext(), this));
@ -183,8 +185,6 @@ void AuRPCPipe::OnFatalError()
}
OnError(true);
AuLogWarn("Disable pipe here");
}
void AuRPCPipe::OnError(bool fatal)