You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while!bytes_written < total_bytes_to_write &&!now < target_response_time do
512
538
let remaining_time = target_response_time -.!now in
513
-
let (_, ready_to_write, _) =Unix.select [] [filedesc] [] remaining_time in(* Note: there is a possibility that the storage could go away after the select and before the write, so the write would block. *)
514
-
ifList.mem filedesc ready_to_write thenbegin
515
-
let bytes_to_write = total_bytes_to_write -!bytes_written in
516
-
let bytes = (try write filedesc data !bytes_written bytes_to_write withUnix.Unix_error(Unix.EAGAIN,_,_) |Unix.Unix_error(Unix.EWOULDBLOCK,_,_) ->0) in(* write from buffer=data from offset=bytes_written, length=bytes_to_write *)
517
-
bytes_written := bytes +!bytes_written;
518
-
end;
539
+
wait remaining_time;
540
+
let bytes_to_write = total_bytes_to_write -!bytes_written in
541
+
let bytes = (try write filedesc data !bytes_written bytes_to_write withUnix.Unix_error(Unix.EAGAIN,_,_) |Unix.Unix_error(Unix.EWOULDBLOCK,_,_) ->0) in(* write from buffer=data from offset=bytes_written, length=bytes_to_write *)
542
+
bytes_written := bytes +!bytes_written;
519
543
now :=Unix.gettimeofday()
520
544
done;
521
545
if!bytes_written = total_bytes_to_write then()else(* we ran out of time *) raise Timeout
@@ -531,19 +555,18 @@ let time_limited_write_substring filedesc length data target_response_time =
531
555
(* Raises Timeout exception if the number of bytes read is less than the desired number. *)
532
556
(* Reads from the file descriptor at the current cursor position. *)
0 commit comments