[mammoth] Finish separating PortServer and PortClient.

This commit is contained in:
Drew Galbraith 2023-06-26 08:59:28 -07:00
parent 5fb9fa6ae6
commit b7a962cc26
10 changed files with 66 additions and 60 deletions

View file

@ -2,7 +2,7 @@
#include <mammoth/debug.h>
#include <mammoth/endpoint_server.h>
#include <mammoth/init.h>
#include <mammoth/port.h>
#include <mammoth/port_client.h>
#include <stdint.h>
#include <yellowstone.h>
@ -26,7 +26,7 @@ uint64_t main(uint64_t init_port_cap) {
check(resp_cap_or.error());
}
auto resp_cap = resp_cap_or.value();
Port notify(resp_cap.second());
PortClient notify = PortClient::AdoptPort(resp_cap.second());
ASSIGN_OR_RETURN(EndpointServer endpoint, EndpointServer::Create());
ASSIGN_OR_RETURN(EndpointClient client, endpoint.CreateClient());

View file

@ -61,9 +61,12 @@ void YellowstoneServer::ServerThread() {
break;
case kYellowstoneGetRegistration: {
dbgln("Yellowstone::GetRegistration");
uint64_t reg_cap;
check(register_port_.CreateClient(&reg_cap));
auto client_or = register_port_.CreateClient();
if (!client_or.ok()) {
check(client_or.error());
}
YellowstoneGetRegistrationResp resp;
uint64_t reg_cap = client_or.value().cap();
check(ZReplyPortSend(reply_port_cap, sizeof(resp), &resp, 1, &reg_cap));
break;
}