-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from talex5/progress
Add connection progress indicator
- Loading branch information
Showing
8 changed files
with
110 additions
and
38 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -602,10 +602,9 @@ let run_client service = | |
let connect uri = | ||
Lwt_main.run begin | ||
Fmt.pr "Connecting to echo service at: %a@." Uri.pp_hum uri; | ||
let client_vat = Capnp_rpc_unix.client_only_vat () in | ||
let sr = Capnp_rpc_unix.Vat.import_exn client_vat uri in | ||
Sturdy_ref.with_cap_exn sr run_client | ||
Capnp_rpc_unix.with_cap_exn sr run_client | ||
end | ||
open Cmdliner | ||
|
@@ -636,12 +635,14 @@ With the server still running in another window, run the client using the `echo. | |
|
||
``` | ||
$ dune exec ./client.exe echo.cap | ||
Connecting to echo service at: capnp://sha-256:[email protected]:7000/JL_hRxzrTSbLNcb0Tqp2f0N_sh5znvY2ym9KMVzLtcQ | ||
Callback got "foo" | ||
Callback got "foo" | ||
Callback got "foo" | ||
``` | ||
|
||
Note that we're using `Capnp_rpc_unix.with_cap_exn` here instead of `Sturdy_ref.with_cap_exn`. | ||
It's almost the same, except that it displays a suitable progress indicator if the connection takes too long. | ||
|
||
### Pipelining | ||
|
||
Let's say the server also offers a logging service, which the client can get from the main echo service: | ||
|
@@ -1291,15 +1292,12 @@ To build: | |
git clone https://github.com/mirage/capnp-rpc.git | ||
cd capnp-rpc | ||
opam pin add -nyk git capnp-rpc . | ||
opam pin add -nyk git capnp-rpc-lwt . | ||
opam pin add -nyk git capnp-rpc-net . | ||
opam pin add -nyk git capnp-rpc-unix . | ||
opam depext capnp-rpc-lwt alcotest | ||
opam install --deps-only -t capnp-rpc-unix | ||
opam pin add -ny . | ||
opam depext -t capnp-rpc-unix capnp-rpc-mirage | ||
opam install --deps-only -t . | ||
make test | ||
If you have trouble building, you can build it with Docker from a known-good state using `docker build .`. | ||
If you have trouble building, you can use the Dockerfile shown in the CI logs (click the green tick on the main page). | ||
### Testing | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters