Skip to content

Commit

Permalink
Merge pull request #587 from mirage/with-new-version-of-paf
Browse files Browse the repository at this point in the history
Follow the upgrade of paf-le-chien
  • Loading branch information
dinosaure authored Sep 28, 2022
2 parents c97cb0d + 195d6eb commit 019f029
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 26 deletions.
3 changes: 3 additions & 0 deletions git-paf.opam
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ build: [
["dune" "runtest" "-p" name "-j" jobs "--no-buffer"] {with-test}
]
dev-repo: "git+https://github.com/mirage/ocaml-git.git"
pin-depends: [
[ "paf.dev" "git+https://github.com/dinosaure/paf-le-chien.git#53ddbdc374ac0ff50b935a384803539e31f12c48" ]
]
3 changes: 1 addition & 2 deletions src/git-mirage/git_mirage_http.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ let git_mirage_http_headers = Mimic.make ~name:"git-mirage-http-headers"
let git_mirage_http_tls_config = Mimic.make ~name:"git-mirage-tls-config"

module Make
(Time : Mirage_time.S)
(Pclock : Mirage_clock.PCLOCK)
(TCP : Tcpip.Tcp.S)
(Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S =
Expand Down Expand Up @@ -125,7 +124,7 @@ struct
~k:k1 ctx
in

Mimic.add Git_paf.git_paf_sleep Time.sleep_ns ctx
ctx

module HTTP = struct
type state =
Expand Down
1 change: 0 additions & 1 deletion src/git-mirage/git_mirage_http.mli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ module type S = sig
end

module Make
(Time : Mirage_time.S)
(Pclock : Mirage_clock.PCLOCK)
(TCP : Tcpip.Tcp.S)
(Happy_eyeballs : Mimic_happy_eyeballs.S with type flow = TCP.flow) : S
9 changes: 1 addition & 8 deletions src/git-paf/git_paf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ module Log = (val Logs.src_log src : Logs.LOG)
let git_paf_scheme = Mimic.make ~name:"git-paf-scheme"
let git_paf_port = Mimic.make ~name:"git-paf-port"
let git_paf_hostname = Mimic.make ~name:"git-paf-hostname"
let git_paf_sleep = Mimic.make ~name:"git-paf-sleep"

let with_uri uri ctx =
let scheme =
Expand Down Expand Up @@ -127,11 +126,6 @@ exception Malformed_response of string
let call ?(ctx = Mimic.empty) ?(headers = Httpaf.Headers.empty) ?body ?chunked
(meth : [ `GET | `POST ]) uri =
let ctx = with_uri uri ctx in
let sleep =
match Mimic.get git_paf_sleep ctx with
| Some sleep -> sleep
| None -> fun _ -> Lwt.return_unit
in
let headers = with_host headers uri in
let headers = with_transfer_encoding ~chunked meth body headers in
let req =
Expand All @@ -151,8 +145,7 @@ let call ?(ctx = Mimic.empty) ?(headers = Httpaf.Headers.empty) ?body ?chunked
let httpaf_body, conn =
Httpaf.Client_connection.request ~error_handler ~response_handler req
in
Lwt.async (fun () ->
Paf.run ~sleep (module Httpaf_Client_connection) conn flow);
Lwt.async (fun () -> Paf.run (module Httpaf_Client_connection) conn flow);
transmit httpaf_body body;
Lwt.pick
[
Expand Down
14 changes: 0 additions & 14 deletions src/git-paf/git_paf.mli
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
val git_paf_scheme : [ `HTTP | `HTTPS ] Mimic.value
val git_paf_port : int Mimic.value
val git_paf_hostname : string Mimic.value
val git_paf_sleep : (int64 -> unit Lwt.t) Mimic.value

type error

Expand All @@ -19,16 +18,3 @@ val post :
Uri.t ->
string ->
(unit * string, error) result Lwt.t

(*
module Make
(Time : Mirage_time.S)
(Pclock : Mirage_clock.PCLOCK)
(Stack : Mirage_stack.V4V6) (TCP : sig
val tcp_endpoint : (Stack.t * Ipaddr.t * int) Mimic.value
val tcp_stack : Stack.t Mimic.value
val tcp_ipaddr : Ipaddr.t Mimic.value
end) : sig
val ctx : Mimic.ctx
end
*)
2 changes: 1 addition & 1 deletion src/git-unix/git_unix_mimic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ let fifo_endpoint, _ = Mimic.register ~name:"fifo" (module FIFO)

module A = Git_mirage_tcp.Make (TCP) (Happy_eyeballs)
module B = Git_mirage_ssh.Make (Mclock) (TCP) (Unix_os.Time) (Happy_eyeballs)
module C = Git_mirage_http.Make (Unix_os.Time) (Pclock) (TCP) (Happy_eyeballs)
module C = Git_mirage_http.Make (Pclock) (TCP) (Happy_eyeballs)

let ctx happy_eyeballs =
let ctx =
Expand Down

0 comments on commit 019f029

Please sign in to comment.