Skip to content

Commit d0a8977

Browse files
committed
Don't log Cancelled exceptions in restorer
Also, fix ref-counting race in test.
1 parent 70b2a4a commit d0a8977

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

capnp-rpc-net/restorer.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ let fn (r:t) =
4747
fun k object_id ->
4848
match r object_id with
4949
| r -> k r
50+
| exception (Eio.Cancel.Cancelled _ as ex) ->
51+
k (reject Capnp_rpc.Exception.cancelled);
52+
raise ex
5053
| exception ex ->
5154
Log.err (fun f -> f "Uncaught exception restoring object: %a" Fmt.exn ex);
5255
k (reject (Capnp_rpc.Exception.v "Internal error restoring object"))

test-lwt/test_lwt.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,8 @@ let test_late_bootstrap ~net =
710710
let make_sturdy () _id = assert false
711711
let load () _sr _name =
712712
Promise.resolve set_connected ();
713-
Promise.await service
713+
Promise.await service;
714+
Capnp_rpc_net.Restorer.grant @@ Echo.local ()
714715
end in
715716
let table = Capnp_rpc_net.Restorer.Table.of_loader ~sw:server_sw (module Loader) () in
716717
let restore = Restorer.of_table table in
@@ -719,7 +720,7 @@ let test_late_bootstrap ~net =
719720
Promise.await connected;
720721
Eio.Cancel.protect @@ fun () ->
721722
Switch.fail client_switch Simulated_failure;
722-
Promise.resolve set_service @@ Capnp_rpc_net.Restorer.grant @@ Echo.local ();
723+
Promise.resolve set_service ();
723724
let service = Capability.await_settled service |> Result.get_error in
724725
Logs.info (fun f -> f "client got: %a" Capnp_rpc.Exception.pp service);
725726
assert (service.Capnp_rpc.Exception.ty = `Disconnected);

0 commit comments

Comments
 (0)