Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmoise17 committed Oct 4, 2024
1 parent 542561e commit ccdd11b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
12 changes: 6 additions & 6 deletions cohttp-async/src/server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ let handle_client handle_request sock rd wr =
Body.drain body >>| fun () -> Ivar.fill_if_empty finished ()
| `Response (req, body, (res, res_body)) ->
(* There are scenarios if a client leaves before consuming the full response,
we might have a reference to an async Pipe that doesn't get drained.
we might have a reference to an async Pipe that doesn't get drained.
Not draining or closing a pipe can lead to issues if its holding a resource like
a file handle as those resources will never be closed, leading to a leak.
Not draining or closing a pipe can lead to issues if its holding a resource like
a file handle as those resources will never be closed, leading to a leak.
Async writers have a promise that's fulfilled whenever they are closed,
so we can use it to schedule a close operation on the stream to ensure that we
don't leave a stream open if the underlying channels are closed. *)
Async writers have a promise that's fulfilled whenever they are closed,
so we can use it to schedule a close operation on the stream to ensure that we
don't leave a stream open if the underlying channels are closed. *)
(match res_body with
| `Empty | `String _ | `Strings _ -> ()
| `Pipe stream ->
Expand Down
3 changes: 2 additions & 1 deletion cohttp-async/test/test_async_integration.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ let ts =
("Pipe with empty strings", Pipe.of_list [ ""; ""; "" ], true);
]
in
Deferred.List.iter ~how:`Sequential tests ~f:(fun (msg, pipe, expected) ->
Deferred.List.iter ~how:`Sequential tests
~f:(fun (msg, pipe, expected) ->
is_empty (`Pipe pipe) >>| fun real ->
assert_equal ~msg expected real)
>>= fun () ->
Expand Down
12 changes: 2 additions & 10 deletions cohttp-lwt-unix/bin/dune
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
(executables
(names cohttp_curl_lwt cohttp_proxy_lwt cohttp_server_lwt)
(libraries
cohttp-lwt-unix
cohttp_server
logs
logs.lwt
logs.fmt
logs.cli
cmdliner
conduit-lwt
fmt.tty)
(libraries cohttp-lwt-unix cohttp_server logs logs.lwt logs.fmt logs.cli
cmdliner conduit-lwt fmt.tty)
(package cohttp-lwt-unix)
(public_names cohttp-curl-lwt cohttp-proxy-lwt cohttp-server-lwt))
3 changes: 2 additions & 1 deletion examples/async/dune
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(executables
(names hello_world receive_post s3_cp)
(libraries mirage-crypto cohttp-async base async_kernel core_unix.command_unix))
(libraries mirage-crypto cohttp-async base async_kernel
core_unix.command_unix))

(alias
(name runtest)
Expand Down
1 change: 0 additions & 1 deletion examples/async/s3_cp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ open Core
open Async
open Cohttp
open Cohttp_async

module Time = Time_float

let ksrt (k, _) (k', _) = String.compare k k'
Expand Down

0 comments on commit ccdd11b

Please sign in to comment.