Skip to content

Commit

Permalink
fix tailcall in recursive loop (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansiwen authored Jul 28, 2024
1 parent a2439ef commit 5af38bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lwt/gluten_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ module IO_loop = struct
(fun () ->
read (module Io) socket read_buffer >>= fun (_ : int) ->
let (_ : int) = Buffer.get read_buffer ~f:(Runtime.read t) in
read_loop_step ())
Lwt.return_unit)
(function
| End_of_file ->
let (_ : int) =
Buffer.get read_buffer ~f:(Runtime.read_eof t)
in
read_loop_step ()
Lwt.return_unit
| exn -> Lwt.fail exn)
>>= read_loop_step
| `Yield ->
Runtime.yield_reader t read_loop;
Lwt.return_unit
Expand Down

0 comments on commit 5af38bf

Please sign in to comment.