Add bootstrap method to TwoPartyServer
This commit is contained in:
@@ -31,6 +31,7 @@ cdef extern from "capnp/helpers/rpcHelper.h":
|
||||
Capability.Client restoreHelper(RpcSystem&, AnyPointer.Reader&)
|
||||
Capability.Client restoreHelper(RpcSystem&, AnyPointer.Builder&)
|
||||
Capability.Client bootstrapHelper(RpcSystem&)
|
||||
Capability.Client bootstrapHelperServer(RpcSystem&)
|
||||
RpcSystem makeRpcClientWithRestorer(TwoPartyVatNetwork&, PyRestorer&)
|
||||
PyPromise connectServerRestorer(TaskSet &, PyRestorer &, AsyncIoContext *, StringPtr)
|
||||
PyPromise connectServer(TaskSet &, Capability.Client, AsyncIoContext *, StringPtr)
|
||||
|
||||
@@ -80,6 +80,13 @@ capnp::Capability::Client bootstrapHelper(capnp::RpcSystem<capnp::rpc::twoparty:
|
||||
return client.bootstrap(hostId);
|
||||
}
|
||||
|
||||
capnp::Capability::Client bootstrapHelperServer(capnp::RpcSystem<capnp::rpc::twoparty::SturdyRefHostId>& client) {
|
||||
capnp::MallocMessageBuilder hostIdMessage(8);
|
||||
auto hostId = hostIdMessage.initRoot<capnp::rpc::twoparty::SturdyRefHostId>();
|
||||
hostId.setSide(capnp::rpc::twoparty::Side::CLIENT);
|
||||
return client.bootstrap(hostId);
|
||||
}
|
||||
|
||||
template <typename SturdyRefHostId, typename ProvisionId,
|
||||
typename RecipientId, typename ThirdPartyCapId, typename JoinAnswer>
|
||||
capnp::RpcSystem<SturdyRefHostId> makeRpcClientWithRestorer(
|
||||
|
||||
@@ -2352,6 +2352,9 @@ cdef class TwoPartyServer:
|
||||
|
||||
wait_forever()
|
||||
|
||||
cpdef bootstrap(self) except +reraise_kj_exception:
|
||||
return _CapabilityClient()._init(helpers.bootstrapHelperServer(deref(self.thisptr)), self)
|
||||
|
||||
property port:
|
||||
def __get__(self):
|
||||
if self._port is None:
|
||||
|
||||
Reference in New Issue
Block a user