AuroraRPC/Source/AuRPCServerChannel.hpp
Jamie Reece Wilson aa7591967a [+] Broadcasts and client/server messages
[+] Async responses
[+] AuRPC::SetRecommendedPipeLength
2023-12-16 18:16:32 +00:00

56 lines
1.3 KiB
C++

/***
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuRPCServerChannel.hpp
Date: 2022-6-29
Author: Reece
***/
#pragma once
#include "AuRPCChannel.hpp"
#include "AuRPCPipe.hpp"
struct AuRPCServerChannel :
AuRPCChannel,
AuIRPCSession,
AuEnableSharedFromThis<AuRPCServerChannel>
{
AuRPCServerChannel(AuSPtr<AuRPC> parent, AuSPtr<AuRPCServer> server);
~AuRPCServerChannel();
bool Init();
AuString ExportString();
void SendResponse(AuSPtr<AuRPCResponse> response);
virtual AuSPtr<AuRPC> ToContext() override;
virtual bool OnConnect() override;
virtual void OnDisconnect(bool error) override;
virtual bool OnDataAvailable(AuByteBuffer& view) override;
virtual AuUInt64 GetConnectTimeNS() override;
virtual void SendMessage(const AuMemoryViewRead &view) override;
void FatalError();
void SendToNewChannel();
void SendConnectOK();
inline void MakeTemp()
{
this->isTempChannel_ = true;
}
void RemoveFromParent();
private:
friend struct AuRPCServer;
AuList<AuSPtr<AuRPCServerChannel>> subchannels_;
AuSPtr<AuRPCServer> server_;
bool isTempChannel_ {};
AuRPCPipe pipe;
AuUInt64 uConnectTime_ {};
AuSPtr<AuRPC> parent;
};