diff --git a/src/dns_forward_lwt_unix/dune b/src/dns_forward_lwt_unix/dune index 1abfc0665..80ea72882 100644 --- a/src/dns_forward_lwt_unix/dune +++ b/src/dns_forward_lwt_unix/dune @@ -1,3 +1,3 @@ (library (name dns_forward_lwt_unix) - (libraries dns_forward lwt lwt.unix cstruct-lwt io-page.unix)) + (libraries dns_forward lwt lwt.unix cstruct-lwt)) diff --git a/src/dns_forward_test/dune b/src/dns_forward_test/dune index 5451a79ca..477414af4 100644 --- a/src/dns_forward_test/dune +++ b/src/dns_forward_test/dune @@ -4,7 +4,7 @@ (executable (name test_fake) - (libraries dns_forward dns_forward_lwt_unix lwt-dllist logs logs.fmt alcotest fake_sleep fake_time)) + (libraries dns_forward dns_forward_lwt_unix lwt-dllist logs logs.fmt alcotest mirage-mtime.mock)) (rule (alias runtest) diff --git a/src/dns_forward_test/fake_sleep/dune b/src/dns_forward_test/fake_sleep/dune deleted file mode 100644 index ad2729b29..000000000 --- a/src/dns_forward_test/fake_sleep/dune +++ /dev/null @@ -1,4 +0,0 @@ -(library - (name fake_sleep) - (libraries lwt fake_time) - (implements mirage-sleep)) diff --git a/src/dns_forward_test/fake_sleep/mirage_sleep.ml b/src/dns_forward_test/fake_sleep/mirage_sleep.ml deleted file mode 100644 index 462dbd182..000000000 --- a/src/dns_forward_test/fake_sleep/mirage_sleep.ml +++ /dev/null @@ -1,33 +0,0 @@ - -(* - * Copyright (C) 2017 Docker Inc - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - *) - -type t = { time : int64; mutable canceled : bool; thread : unit Lwt.u } - -let ns n = - let open Lwt.Infix in - (* All sleeping is relative to the start of the program for now *) - let now = 0L in - let rec loop () = - let tod = !Fake_time_state.timeofday in - if tod > Int64.add now n then Lwt.return_unit else ( - Lwt_condition.wait Fake_time_state.c >>= fun () -> - loop () - ) in - loop () - -let new_sleepers () = [] diff --git a/src/dns_forward_test/fake_time/dune b/src/dns_forward_test/fake_time/dune deleted file mode 100644 index 740e71fad..000000000 --- a/src/dns_forward_test/fake_time/dune +++ /dev/null @@ -1,4 +0,0 @@ -(library - (name fake_time) - (implements mirage-mtime) - (libraries lwt)) diff --git a/src/dns_forward_test/fake_time/fake_time_state.ml b/src/dns_forward_test/fake_time/fake_time_state.ml deleted file mode 100644 index 597f1bcb4..000000000 --- a/src/dns_forward_test/fake_time/fake_time_state.ml +++ /dev/null @@ -1,10 +0,0 @@ -let timeofday = ref 0L -let c = Lwt_condition.create () - -let advance nsecs = - timeofday := Int64.add !timeofday nsecs; - Lwt_condition.broadcast c () - -let reset () = - timeofday := 0L; - Lwt_condition.broadcast c () diff --git a/src/dns_forward_test/fake_time/mirage_mtime.ml b/src/dns_forward_test/fake_time/mirage_mtime.ml deleted file mode 100644 index 1544bd3a0..000000000 --- a/src/dns_forward_test/fake_time/mirage_mtime.ml +++ /dev/null @@ -1,19 +0,0 @@ -(* - * Copyright (C) 2017 Docker Inc - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - *) - -let elapsed_ns () = !Fake_time_state.timeofday -let period_ns () = None diff --git a/src/dns_forward_test/test_fake.ml b/src/dns_forward_test/test_fake.ml index e66299419..10f17a7bd 100644 --- a/src/dns_forward_test/test_fake.ml +++ b/src/dns_forward_test/test_fake.ml @@ -64,11 +64,11 @@ let test_good_dead_server () = let t = R.answer request r in (* First request will trigger the internal timeout and mark the bad server as offline. The sleep timeout here will only trigger if this fails. *) - Fake_time_state.advance Duration.(of_sec 1); + Mirage_mtime_set.tick_for Duration.(of_sec 1); (* HACK: we want to let all threads run until they block but we don't have an API for that. This assumes that all computation will finish in 0.1s *) Lwt_unix.sleep 0.1 >>= fun () -> - Fake_time_state.advance Duration.(of_sec 1); + Mirage_mtime_set.tick_for Duration.(of_sec 1); Lwt_unix.sleep 0.1 >>= fun () -> Lwt.pick [ (Lwt_unix.sleep 1. >>= fun () -> Lwt.fail_with "test_good_dead_server: initial request had no response"); @@ -76,8 +76,8 @@ let test_good_dead_server () = ] >>= fun () -> (* The bad server should be marked offline and no-one will wait for it *) - Fake_time_state.reset (); - Fake_time_state.advance Duration.(of_ms 500); (* avoid the timeouts winning the race with the actual result *) + Mirage_mtime_set.reset (); + Mirage_mtime_set.tick_for Duration.(of_ms 500); (* avoid the timeouts winning the race with the actual result *) let request = R.answer request r >>= function diff --git a/src/hostnet/dune b/src/hostnet/dune index 9dc2dc44b..2047c5d51 100644 --- a/src/hostnet/dune +++ b/src/hostnet/dune @@ -7,7 +7,7 @@ tcpip.tcp tcpip.stack-direct charrua charrua-server dns dns_lwt ofs luv luv_unix lwt.unix threads astring fs9p dns_forward tar mirage-vnetif uuidm cohttp-lwt mirage-channel ezjsonm - duration mirage-time + duration io-page tcpip.checksum forwarder cstructs sha) (foreign_stubs (language c) (names stubs_utils)) (wrapped false)) diff --git a/src/ofs/dune b/src/ofs/dune index 170469fbd..c497ed2d3 100644 --- a/src/ofs/dune +++ b/src/ofs/dune @@ -1,5 +1,5 @@ (library (name ofs) - (libraries protocol-9p cstruct io-page-unix logs astring mirage-time + (libraries protocol-9p cstruct logs astring mirage-flow duration) (wrapped false)) diff --git a/vpnkit.opam b/vpnkit.opam index dab6481c9..490952e27 100644 --- a/vpnkit.opam +++ b/vpnkit.opam @@ -40,7 +40,7 @@ depends: [ "charrua" {>= "1.3.0"} "charrua-client" "charrua-server" - "hvsock" {>= "3.0.1"} + "hvsock" {>= "3.1.0"} "fd-send-recv" {>= "2.0.0"} "logs" "fmt" @@ -52,15 +52,15 @@ depends: [ "mirage-net" {>= "4.0.0"} "mirage-channel" {>= "4.0.1"} "cohttp-lwt" {>= "0.99.0" & < "6.0.0"} - "protocol-9p" {>= "2.0.2"} + "protocol-9p" {>= "2.1.0"} "mirage-vnetif" {>= "0.5.0"} - "io-page-unix" + "io-page" {>= "3.0.0"} "uuidm" "ezjsonm" {>= "0.4.0"} "sha" {with-test} "stringext" "mirage-sleep" {>= "4.0.0"} - "mirage-mtime" {>= "5.0.0"} + "mirage-mtime" {>= "5.1.0"} "re" {>= "1.9.0"} "ppx_inline_test" ] @@ -70,7 +70,3 @@ HyperKit is a hypervisor which runs on macOS using the "hypervisor.framework". VPNKit implements a virtual ethernet device for HyperKit VMs in a VPN-friendly way, by terminating and proxying all the TCP flows, caching and forwarding DNS requests etc. HyperKit and VPNKit are used in Docker for Mac and Windows.""" -pin-depends:[ - [ "hvsock.dev" "git+https://github.com/patricoferris/ocaml-hvsock#addfc643a4d784b95540a7e3148db74e3943758d" ] - [ "protocol-9p.dev" "git+https://github.com/patricoferris/ocaml-9p#2d512928b4dc06c28a9a171e0163b59c19155495" ] -]