[Yunq] Release server cap on destructor.

This commit is contained in:
Drew Galbraith 2023-11-27 08:11:52 -08:00
parent 43d7bfa7ad
commit 96a2f74e14
14 changed files with 123 additions and 8 deletions

View file

@ -29,6 +29,12 @@ void YellowstoneServerBaseThreadBootstrap(void* server_base) {
((YellowstoneServerBase*)server_base)->ServerThread();
}
YellowstoneServerBase::~YellowstoneServerBase() {
if (endpoint_ != 0) {
check(ZCapRelease(endpoint_));
}
}
glcr::ErrorOr<YellowstoneClient> YellowstoneServerBase::CreateClient() {
uint64_t client_cap;
RET_ERR(ZCapDuplicate(endpoint_, ~(kZionPerm_Read), &client_cap));

View file

@ -15,6 +15,7 @@ class YellowstoneServerBase {
YellowstoneServerBase(z_cap_t Yellowstone_cap) : endpoint_(Yellowstone_cap) {}
YellowstoneServerBase(const YellowstoneServerBase&) = delete;
YellowstoneServerBase(YellowstoneServerBase&&) = delete;
virtual ~YellowstoneServerBase();
glcr::ErrorOr<YellowstoneClient> CreateClient();