Skip to content

Commit

Permalink
Async unix debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
nholland94 committed Feb 14, 2022
1 parent 59b9e5b commit 9cce464
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@
[submodule "src/external/capnp-ocaml"]
path = src/external/capnp-ocaml
url = https://github.com/o1-labs/capnp-ocaml.git
[submodule "src/external/async_unix"]
path = src/external/async_unix
url = https://github.com/nholland94/async_unix.git
1 change: 1 addition & 0 deletions src/external/async_unix
Submodule async_unix added at 654584
2 changes: 1 addition & 1 deletion src/external/dune
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(dirs :standard \ async_kernel)
(dirs :standard \ async_kernel async_unix)
5 changes: 4 additions & 1 deletion src/lib/child_processes/child_processes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ let reader_to_strict_pipe reader output_type =
| `Chunks ->
Reader.pipe reader
| `Lines ->
Reader.lines reader
(* Reader.lines reader *)
Async_unix.Reader.lines
~trace:({ Reader.trace = O1trace.time_execution' } : Reader.trace_f)
reader
in
Strict_pipe.Reader.of_linear_pipe { pipe; has_reader = false }

Expand Down
11 changes: 6 additions & 5 deletions src/libp2p_ipc/libp2p_ipc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,13 @@ let rec stream_messages frag_stream w =
let read_incoming_messages reader =
let r, w = Strict_pipe.create Strict_pipe.Synchronous in
let fragment_stream = Fragment_stream.create () in
O1trace.time_execution "ipc_stream_messages" (fun () -> don't_wait_for (stream_messages fragment_stream w)) ;
O1trace.time_execution "ipc_stream_messages" (fun () ->
don't_wait_for (stream_messages fragment_stream w)) ;
O1trace.time_execution "ipc_adding_fragments" (fun () ->
don't_wait_for
(Strict_pipe.Reader.iter_without_pushback reader ~f:(fun fragment ->
Fragment_stream.add_fragment fragment_stream
(Stdlib.Bytes.unsafe_of_string fragment)))) ;
don't_wait_for
(Strict_pipe.Reader.iter_without_pushback reader ~f:(fun fragment ->
Fragment_stream.add_fragment fragment_stream
(Stdlib.Bytes.unsafe_of_string fragment)))) ;
r

let write_outgoing_message writer msg =
Expand Down

0 comments on commit 9cce464

Please sign in to comment.