[mammoth] Run EndpointServer in its own thread.

This commit is contained in:
Drew Galbraith 2023-08-01 16:08:34 -07:00
parent caccb08e16
commit c70b5b0753
4 changed files with 25 additions and 15 deletions

View file

@ -7,6 +7,7 @@
#include "mammoth/endpoint_client.h"
#include "mammoth/request_context.h"
#include "mammoth/response_context.h"
#include "mammoth/thread.h"
class EndpointServer {
public:
@ -15,13 +16,8 @@ class EndpointServer {
EndpointServer& operator=(const EndpointServer&) = delete;
glcr::ErrorOr<glcr::UniquePtr<EndpointClient>> CreateClient();
// FIXME: Release Cap here.
z_cap_t GetCap() { return endpoint_cap_; }
glcr::ErrorCode Receive(uint64_t* num_bytes, void* data,
z_cap_t* reply_port_cap);
glcr::ErrorCode RunServer();
Thread RunServer();
virtual glcr::ErrorCode HandleRequest(RequestContext& request,
ResponseContext& response) = 0;
@ -34,4 +30,7 @@ class EndpointServer {
static const uint64_t kBufferSize = 1024;
uint8_t recieve_buffer_[kBufferSize];
friend void EndpointServerThreadBootstrap(void* endpoint_server);
void ServerThread();
};