From 88953d5904be710bd2f4117fb525782d576e7c14 Mon Sep 17 00:00:00 2001 From: Ian Denhardt Date: Mon, 13 Feb 2023 19:00:35 -0500 Subject: [PATCH] recvCap: use the vine for thirdPartyHosted caps. This will ease compatibility with future versions of go-capnp which support 3PH; per the comments in rpc.capnp, implementations which do not support 3PH can just use the vine to treat the capability just like senderHosted. --- rpc/rpc.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rpc/rpc.go b/rpc/rpc.go index 5d63e8a3..ff5ab3bc 100644 --- a/rpc/rpc.go +++ b/rpc/rpc.go @@ -1305,6 +1305,18 @@ func (c *lockedConn) recvCap(d rpccp.CapDescriptor) (capnp.Client, error) { // > rather than being delivered locally. id := importID(d.SenderPromise()) return c.addImport(id), nil + case rpccp.CapDescriptor_Which_thirdPartyHosted: + // We don't support third-party handoff yet, so instead of trying to + // pick this up, use the vine and treat it the same as senderHosted: + thirdPartyDesc, err := d.ThirdPartyHosted() + if err != nil { + return capnp.Client{}, exc.WrapError( + "reading ThridPartyCapDescriptor", + err, + ) + } + id := importID(thirdPartyDesc.VineId()) + return c.addImport(id), nil case rpccp.CapDescriptor_Which_receiverHosted: id := exportID(d.ReceiverHosted()) ent := c.findExport(id)