Skip to content

Commit

Permalink
fix(master_connection): avoid Thread.wait_timed_read, just as bad as …
Browse files Browse the repository at this point in the history
…Unix.select

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Jun 18, 2024
1 parent 5ff5df9 commit 82f4969
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions ocaml/database/dune
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
rpclib.core
rpclib.json
safe-resources
polly
stunnel
threads.posix
http_lib
Expand Down
5 changes: 4 additions & 1 deletion ocaml/database/master_connection.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ let open_secure_connection () =
~write_to_log:(fun x -> debug "stunnel: %s\n" x)
~verify_cert host port
@@ fun st_proc ->
let fd_closed = Thread.wait_timed_read Unixfd.(!(st_proc.Stunnel.fd)) 5. in
let polly = Polly.create () in
let finally () = Polly.close polly in
Fun.protect ~finally @@ fun () ->
let fd_closed = Polly.wait polly 1 5000 (fun _ _ _ -> ()) > 0 in
let proc_quit =
try
Unix.kill (Stunnel.getpid st_proc.Stunnel.pid) 0 ;
Expand Down

0 comments on commit 82f4969

Please sign in to comment.