Skip to content

Commit

Permalink
Implement the Free() RPC (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
bifurcation authored Apr 6, 2023
1 parent 14d0b7e commit 623acd0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/interop/src/mls_client_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,20 @@ MLSClientImpl::HandleBranch(ServerContext* /* context */,
});
}

Status
MLSClientImpl::Free(ServerContext* /* context */,
const FreeRequest* request,
FreeResponse* /* response */)
{
const auto state_id = request->state_id();
if (state_cache.count(state_id) == 0) {
return Status(StatusCode::NOT_FOUND, "Unknown state");
}

remove_state(state_id);
return Status::OK;
}

// Cached join transactions
uint32_t
MLSClientImpl::store_join(KeyPackageWithSecrets&& kp_priv)
Expand Down
5 changes: 5 additions & 0 deletions cmd/interop/src/mls_client_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ class MLSClientImpl final : public MLSClient::Service
const HandleBranchRequest* request,
HandleBranchResponse* response) override;

// Cleanup
Status Free(ServerContext* context,
const FreeRequest* request,
FreeResponse* response) override;

private:
// Wrapper for methods that rely on state
template<typename Req, typename F>
Expand Down

0 comments on commit 623acd0

Please sign in to comment.