Skip to content

Commit

Permalink
cohttp-lwt: Don't leak asynchronous Retry exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
mefyl committed Jul 19, 2023
1 parent de39002 commit 0f1ed76
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cohttp-lwt/src/connection_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ end = struct
>>= fun connection ->
let res = Connection.call connection ?headers ?body meth uri in
(* this can be simplified when https://github.com/mirage/ocaml-conduit/pull/319 is released. *)
Lwt.async (fun () ->
Lwt.dont_wait (fun () ->
res >>= fun (_, body) ->
(match body with
| `Empty | `String _ | `Strings _ -> Lwt.return_unit
| `Stream stream -> Lwt_stream.closed stream)
>>= fun () ->
Connection.close connection;
Lwt.return_unit);
Lwt.return_unit)
(function
| Retry -> ()
| e -> raise e);
res
end

Expand Down

0 comments on commit 0f1ed76

Please sign in to comment.