mirror of
https://github.com/yuzu-emu/discord-rpc
synced 2024-11-23 14:13:46 +00:00
less stubby
This commit is contained in:
parent
2212ba5c43
commit
72446df921
1 changed files with 18 additions and 4 deletions
|
@ -1,13 +1,24 @@
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
|
||||||
|
const int RpcVersion = 1;
|
||||||
|
const int NumFrames = 4;
|
||||||
|
|
||||||
|
struct RpcConnectionUnix : public RpcConnection {
|
||||||
|
int pipe{-1};
|
||||||
|
RpcMessageFrame frames[NumFrames];
|
||||||
|
int nextFrame{0};
|
||||||
|
};
|
||||||
|
|
||||||
/*static*/ RpcConnection* RpcConnection::Create(const char* applicationId)
|
/*static*/ RpcConnection* RpcConnection::Create(const char* applicationId)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return new RpcConnectionUnix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static*/ void RpcConnection::Destroy(RpcConnection*&)
|
/*static*/ void RpcConnection::Destroy(RpcConnection*& c)
|
||||||
{
|
{
|
||||||
|
auto self = reinterpret_cast<RpcConnectionUnix*&>(c);
|
||||||
|
delete self;
|
||||||
|
c = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RpcConnection::Open()
|
void RpcConnection::Open()
|
||||||
|
@ -32,7 +43,10 @@ RpcMessageFrame* RpcConnection::Read()
|
||||||
|
|
||||||
RpcMessageFrame* RpcConnection::GetNextFrame()
|
RpcMessageFrame* RpcConnection::GetNextFrame()
|
||||||
{
|
{
|
||||||
return nullptr;
|
auto self = reinterpret_cast<RpcConnectionUnix*>(this);
|
||||||
|
auto result = &(self->frames[self->nextFrame]);
|
||||||
|
self->nextFrame = (self->nextFrame + 1) % NumFrames;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RpcConnection::WriteFrame(RpcMessageFrame* frame)
|
void RpcConnection::WriteFrame(RpcMessageFrame* frame)
|
||||||
|
|
Loading…
Reference in a new issue