Skip to content

Commit

Permalink
Also update caqti_tls_async.ml to 1.0.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
paurkedal committed Sep 2, 2024
1 parent fd4339b commit 7e0cfd8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions caqti-tls-async/lib/caqti_tls_async.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ let try_to_close t =
;;

let pipe t =
let b_reader = Cstruct.create 0x8000 in
let b_reader = Bytes.create 0x8000 in
let rec f_reader writer =
match%bind Session.read t b_reader with
| Ok 0 ->
Pipe.close writer;
return ()
| Ok len ->
let%bind () = Pipe.write writer (Cstruct.to_string (Cstruct.sub b_reader 0 len)) in
let%bind () = Pipe.write writer (Stdlib.Bytes.sub_string b_reader 0 len) in
f_reader writer
| Error read_error ->
let%map () =
Expand All @@ -54,7 +54,7 @@ let pipe t =
let%bind pipe_read = Pipe.read reader in
match pipe_read with
| `Ok s ->
(match%bind Session.writev t [ Cstruct.of_string s ] with
(match%bind Session.writev t [ s ] with
| Ok () -> f_writer reader
| Error (_ : Error.t) -> try_to_close t)
| `Eof -> try_to_close t
Expand Down

0 comments on commit 7e0cfd8

Please sign in to comment.