Skip to content

Commit b629b55

Browse files
authored
Merge pull request #67 from Firobe/flush-body-before-close
[lwt] flush body writer before closing
2 parents 6296283 + ca2d63a commit b629b55

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/grpc-lwt/client.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ module Rpc = struct
8484
let unary ~f enc write_body read_body =
8585
let payload = Grpc.Message.make enc in
8686
H2.Body.Writer.write_string write_body payload;
87+
let wait_until_flushed, flushed = Lwt.wait () in
88+
let callback _ = Lwt.wakeup flushed () in
89+
H2.Body.Writer.flush write_body callback;
90+
let* () = wait_until_flushed in
8791
H2.Body.Writer.close write_body;
8892
let* read_body = read_body in
8993
let request_buffer = Grpc.Buffer.v () in

0 commit comments

Comments
 (0)