Compare commits

..

2 commits

Author SHA1 Message Date
992127f2bd Merge pull request 'of_octets: create ring buffer earlier to avoid missing data' (!5) from fix-of-octets into main
Reviewed-on: #5
Reviewed-by: Reynir Björnsson <reynir@reynir.dk>
Reviewed-by: dinosaure <romain.calascibetta@gmail.com>
2024-11-28 10:16:33 +00:00
bcd49ccfcf of_octets: create ring buffer earlier to avoid missing data 2024-11-20 10:32:27 +01:00

View file

@ -278,8 +278,7 @@ let map buf ~pos len =
let blit_from_string src src_off dst dst_off len = let blit_from_string src src_off dst dst_off len =
Bigstringaf.blit_from_string src ~src_off dst ~dst_off ~len Bigstringaf.blit_from_string src ~src_off dst ~dst_off ~len
let read stream = let read ke stream =
let ke = Ke.Rke.create ~capacity:0x1000 Bigarray.char in
let rec go filled input = let rec go filled input =
match Ke.Rke.N.peek ke with match Ke.Rke.N.peek ke with
| [] -> begin | [] -> begin
@ -302,9 +301,10 @@ let read stream =
let analyze store stream = let analyze store stream =
let tmp = Cstruct.create 0x1000 in let tmp = Cstruct.create 0x1000 in
let buf = Buffer.create 0x1000 in let buf = Buffer.create 0x1000 in
let ke = Ke.Rke.create ~capacity:0x1000 Bigarray.char in
let read_cstruct tmp = let read_cstruct tmp =
let open Lwt.Infix in let open Lwt.Infix in
read stream tmp >>= fun len -> read ke stream tmp >>= fun len ->
Buffer.add_string buf (Cstruct.to_string ~off:0 ~len tmp); Buffer.add_string buf (Cstruct.to_string ~off:0 ~len tmp);
Lwt.return len in Lwt.return len in
let allocate bits = De.make_window ~bits in let allocate bits = De.make_window ~bits in