Skip to content

Commit

Permalink
fixup! JSRPC: Support pipelined access to properties of RPC targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
kentonv committed Feb 26, 2024
1 parent d3a7914 commit be2ae30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/workerd/api/http.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,8 @@ rpc::JsRpcTarget::Client Fetcher::getClientForOneCall(
ioContext.addTask(worker->customEvent(kj::mv(event)).attach(kj::mv(worker))
.then([](auto&&) {}, [](kj::Exception&&) {}));

// (Don't extend `path` because we're the root.)

return result;
}

Expand Down
3 changes: 3 additions & 0 deletions src/workerd/api/worker-rpc.c++
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ JsRpcProperty::PromiseAndPipleine JsRpcProperty::callImpl(jsg::Lock& js, FillOpF
// methods off their source object, even if we change implementations to something where that's
// less convenient.

// `path` will be filled in with the path of property names leading from the stub represented by
// `client` to the specific property / method that we're trying to invoke.
kj::Vector<kj::StringPtr> path;
auto client = parent->getClientForOneCall(js, path);

Expand Down Expand Up @@ -313,6 +315,7 @@ kj::Maybe<jsg::Ref<JsRpcProperty>> JsRpcPromise::getProperty(jsg::Lock& js, kj::

rpc::JsRpcTarget::Client JsRpcStub::getClientForOneCall(
jsg::Lock& js, kj::Vector<kj::StringPtr>& path) {
// (Don't extend `path` because we're the root.)
return *capnpClient;
}

Expand Down

0 comments on commit be2ae30

Please sign in to comment.