AuroraRPC/Source/AuRPCServerChannel.hpp

44 lines
980 B
C++
Raw Normal View History

2022-07-02 22:08:52 +00:00
/***
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
{
AuRPCServerChannel(AuSPtr<AuRPC> parent, AuSPtr<AuRPCServer> server);
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;
void FatalError();
void SendToNewChannel();
void SendConnectOK();
inline void MakeTemp()
{
this->isTempChannel_ = true;
}
private:
AuList<AuSPtr<AuRPCServerChannel>> subchannels_;
AuSPtr<AuRPCServer> server_;
bool isTempChannel_ {};
AuRPCPipe pipe;
AuSPtr<AuRPC> parent;
};