Skip to content

Commit

Permalink
update comment about keeping promise imports alive
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Sep 2, 2024
1 parent bb2f25d commit 42c361f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions capnp-rpc/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1488,9 +1488,14 @@ impl<VatId> ConnectionState<VatId> {
let client: Box<Client<VatId>> = Box::new(import_client.into());
let client: Box<dyn ClientHook> = client;

// XXX do I need something like this?
// Make sure the import is not destroyed while this promise exists.
// let promise = promise.attach(client.add_ref());
// Here the C++ implementation does something like:
// ```
// // Make sure the import is not destroyed while this promise exists.
// let promise = promise.attach(client.add_ref());
// ```
// However, as far as I can tell that is unnecessary, because the
// PromiseClient holds `client` until it resolves, after which point
// there is no reason to keep the import alive.

let client = PromiseClient::new(&connection_state, client, Some(import_id));

Expand Down

0 comments on commit 42c361f

Please sign in to comment.