Skip to content

Commit 42c361f

Browse files
committed
update comment about keeping promise imports alive
1 parent bb2f25d commit 42c361f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

capnp-rpc/src/rpc.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,9 +1488,14 @@ impl<VatId> ConnectionState<VatId> {
14881488
let client: Box<Client<VatId>> = Box::new(import_client.into());
14891489
let client: Box<dyn ClientHook> = client;
14901490

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

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

0 commit comments

Comments
 (0)