File tree Expand file tree Collapse file tree 3 files changed +17
-13
lines changed
Expand file tree Collapse file tree 3 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ build-test: [
1515depends: [
1616 "jbuilder" {build & >= "1.0+beta10"}
1717 "faraday-lwt"
18- "lwt"
18+ "lwt" {>= "2.7.0"}
1919 "base-unix"
2020]
2121available: [ ocaml-version >= "4.02.0" ]
Original file line number Diff line number Diff line change 1- open Lwt
2-
31include Faraday_lwt
42
5- let write_bigstring fd buf off len =
6- try Lwt_bytes. write fd buf off len > |= fun n -> `Ok n
7- with Unix. Unix_error (Unix. EBADF, "check_descriptor" , _ ) -> return `Closed
3+ open Lwt.Infix
84
95let writev_of_fd fd =
10- (* XXX(seliopou): This function only writes the first iovec because lwt
11- currently does not expose a writev function. That system call should be
12- bound manually at some point in the future. *)
13- function
14- | [] -> assert false
15- | { Faraday. buffer; off; len } ::_ -> write_bigstring fd buffer off len
6+ fun iovecs ->
7+ let lwt_iovecs = Lwt_unix.IO_vectors. create () in
8+ iovecs |> List. iter (fun {Faraday. buffer; off; len} ->
9+ Lwt_unix.IO_vectors. append_bigarray lwt_iovecs buffer off len);
10+
11+ Lwt. catch
12+ (fun () ->
13+ Lwt_unix. writev fd lwt_iovecs
14+ > |= fun n -> `Ok n)
15+ (function
16+ | Unix. Unix_error (Unix. EBADF, "check_descriptor" , _ ) ->
17+ Lwt. return `Closed
18+ | exn ->
19+ Lwt. fail exn )
Original file line number Diff line number Diff line change 55 (public_name faraday-lwt-unix)
66 (wrapped false)
77 (libraries
8- (faraday lwt faraday-lwt))
8+ (faraday lwt lwt.unix faraday-lwt))
99 (flags (:standard -safe-string))))
You can’t perform that action at this time.
0 commit comments