Lwt_utils: fix read_mbytes
This commit is contained in:
parent
8680d98ecd
commit
f7b149c9ed
@ -242,8 +242,9 @@ let read_mbytes ?(pos=0) ?len fd buf =
|
|||||||
if len = 0 then
|
if len = 0 then
|
||||||
Lwt.return_unit
|
Lwt.return_unit
|
||||||
else
|
else
|
||||||
Lwt_bytes.read fd buf pos len >>= fun nb_read ->
|
Lwt_bytes.read fd buf pos len >>= function
|
||||||
inner (pos + nb_read) (len - nb_read)
|
| 0 -> Lwt.fail End_of_file (* other endpoint cleanly closed its connection *)
|
||||||
|
| nb_read -> inner (pos + nb_read) (len - nb_read)
|
||||||
in
|
in
|
||||||
inner pos len
|
inner pos len
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user