From 7d53f16a7b0be49ad600b352f88c3b988cb24052 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Sat, 22 Dec 2018 14:56:49 -0500 Subject: [PATCH 01/29] Refresh dependency versions --- Cargo.lock | 592 +++++++++++++++++++++++++++++++---------------------- Cargo.toml | 10 +- 2 files changed, 357 insertions(+), 245 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a9358a..1630f7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,12 +5,12 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "arrayvec" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -18,17 +18,16 @@ dependencies = [ [[package]] name = "atty" -version = "0.2.11" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -63,6 +62,15 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "buf_redux" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "byte-tools" version = "0.3.1" @@ -79,10 +87,19 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "c2-chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "cfg-if" version = "0.1.9" @@ -94,11 +111,11 @@ version = "2.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -115,21 +132,21 @@ name = "crossbeam-deque" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -137,21 +154,21 @@ name = "crossbeam-queue" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-utils" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "custom_error" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -169,7 +186,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "either" -version = "1.5.2" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -203,7 +220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.1.28" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -211,7 +228,7 @@ name = "futures-cpupool" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -220,21 +237,31 @@ name = "generic-array" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "getrandom" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "h2" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -242,16 +269,15 @@ dependencies = [ [[package]] name = "headers" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "headers-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "headers-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -262,22 +288,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "headers-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "http" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -291,8 +307,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -303,19 +319,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.12.31" +version = "0.12.35" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -332,7 +348,7 @@ dependencies = [ [[package]] name = "idna" -version = "0.1.5" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -342,7 +358,7 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.0.2" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -358,7 +374,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -378,12 +394,12 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.58" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -397,7 +413,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.6" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -409,27 +433,49 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "memoffset" -version = "0.2.1" +name = "memchr" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "mime" -version = "0.3.13" +name = "memoffset" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "mime_guess" +version = "1.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mime_guess" -version = "2.0.0-alpha.6" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", - "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", - "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -441,8 +487,8 @@ dependencies = [ "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -455,7 +501,7 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -470,14 +516,31 @@ dependencies = [ "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "multipart" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "buf_redux 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 1.8.7 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "twoway 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -490,14 +553,9 @@ name = "num_cpus" version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "numtoa" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "odds" version = "0.3.1" @@ -510,7 +568,7 @@ dependencies = [ [[package]] name = "opaque-debug" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -535,16 +593,16 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "percent-encoding" -version = "1.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -583,37 +641,43 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "ppv-lite86" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] -name = "quote" -version = "0.6.12" +name = "quick-error" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -621,23 +685,40 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rand_core" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -646,6 +727,14 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -659,9 +748,9 @@ name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -671,10 +760,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -682,8 +771,8 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -721,11 +810,11 @@ version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "redox_termios" -version = "0.1.1" +name = "remove_dir_all" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -741,6 +830,11 @@ name = "ryu" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "safemem" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scoped-tls" version = "1.0.0" @@ -751,6 +845,11 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scopeguard" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "semver" version = "0.9.0" @@ -766,7 +865,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.94" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -776,18 +875,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_urlencoded" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -798,7 +897,7 @@ dependencies = [ "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -835,24 +934,16 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "syn" -version = "0.15.39" +name = "tempfile" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "termion" -version = "1.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -860,7 +951,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -868,9 +959,9 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -879,7 +970,7 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -892,7 +983,7 @@ dependencies = [ "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -902,8 +993,8 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -912,7 +1003,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -921,7 +1012,7 @@ name = "tokio-current-thread" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -930,8 +1021,8 @@ name = "tokio-executor" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -939,7 +1030,7 @@ name = "tokio-fs" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -950,8 +1041,8 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -959,10 +1050,10 @@ name = "tokio-reactor" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -978,7 +1069,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -987,7 +1078,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1001,9 +1092,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1015,20 +1106,20 @@ name = "tokio-timer" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-udp" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1041,10 +1132,10 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1059,25 +1150,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tungstenite" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "twoway" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "typenum" -version = "1.10.0" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1095,7 +1194,7 @@ dependencies = [ [[package]] name = "unicase" -version = "2.4.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1119,22 +1218,17 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "unicode-xid" -version = "0.1.0" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "url" -version = "1.7.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1162,35 +1256,41 @@ name = "want" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "warp" -version = "0.1.16" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "headers 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "headers 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "multipart 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", - "tungstenite 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tungstenite 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wasi" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "weak-table" version = "0.2.3" @@ -1202,15 +1302,15 @@ version = "0.2.0" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "custom_error 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)", + "custom_error 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "warp 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "warp 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "weak-table 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1221,7 +1321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1254,81 +1354,91 @@ dependencies = [ [metadata] "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" -"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" +"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6d4dc3af3ee2e12f3e5d224e5e1e3d73668abbeb69e566d361f7d5563a4fdf09" +"checksum buf_redux 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +"checksum c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d64d04786e0f528460fc884753cf8dddcc466be308f6026f8e355c41a0e4101" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" -"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" +"checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" -"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" -"checksum custom_error 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c189751d60563837f66c7ebf87f6a6e4c101e937d54521e88620e89c79b8a2ad" +"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6" +"checksum custom_error 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "93a0fc65739ae998afc8d68e64bdac2efd1bc4ffa1a0703d171ef2defae3792f" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" -"checksum either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5527cfe0d098f36e3f8839852688e63c8fff1c90b2b405aef730615f9a7bcf7b" +"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" "checksum fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" +"checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -"checksum h2 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "a539b63339fbbb00e081e84b6e11bd1d9634a82d91da2984a18ac74a8823f392" -"checksum headers 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6e2e51d356081258ef05ff4c648138b5d3fe64b7300aaad3b820554a2b7fb6" +"checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571" +"checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +"checksum headers 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "882ca7d8722f33ce2c2db44f95425d6267ed59ca96ce02acbe58320054ceb642" "checksum headers-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "967131279aaa9f7c20c7205b45a391638a83ab118e6509b2d0ccbe08de044237" -"checksum headers-derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97c462e8066bca4f0968ddf8d12de64c40f2c2187b3b9a2fa994d06e8ad444a9" -"checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" +"checksum http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "372bcb56f939e449117fb0869c2e8fd8753a8223d92a172c6e808cf123a5b6e4" "checksum http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" -"checksum hyper 0.12.31 (registry+https://github.com/rust-lang/crates.io-index)" = "6481fff8269772d4463253ca83c788104a7305cb3fb9136bc651a6211e46e03f" -"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" +"checksum hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)" = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" +"checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +"checksum indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a61202fbe46c4a951e9404a720a0180bcf3212c750d735cb5c4ba4dc551299f3" "checksum input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e1b822cc844905551931d6f81608ed5f50a79c1078a4e2b4d42dbc7c1eedfbf" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)" = "6281b86796ba5e4366000be6e9e18bf35580adf9e63fbe2294aadb587613a319" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" -"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425" -"checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" +"checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" +"checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +"checksum mime 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "dd1d63acd1b78403cc0c325605908475dd9b9a3acbf65ed8bcab97e27014afcf" +"checksum mime_guess 1.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0d977de9ee851a0b16e932979515c0f3da82403183879811bc97d50bd9cc50f7" +"checksum mime_guess 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a0ed03949aef72dbdf3116a383d7b38b4768e6f960528cd6a6044aa9ed68599" "checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +"checksum multipart 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)" = "136eed74cadb9edd2651ffba732b19a450316b680e4f48d6c79e905799e19d01" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273" -"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9a18d7081eb052145753e982d7b8de495f15f74636d0d963f09116581eab665" -"checksum opaque-debug 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "93f5bb2e8e8dec81642920ccff6b61f1eb94fa3020c5a325c9851ff604152409" +"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" -"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" "checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" -"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03a2a90da8c7523f554344f921aa97283eadf6ac484a6d2a7d0212fa7f8d6853" "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -"checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" +"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" +"checksum rand_core 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" "checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" @@ -1338,16 +1448,18 @@ dependencies = [ "checksum rawslice 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "22b23b9f57ea250c6db4b21e2897b43ff08209217ca8260469fae6c0f9ad7e25" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" -"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" +"checksum safemem 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d2b08423011dae9a5ca23f07cf57dac3857f5c885d352b76f6d95f4aea9434d0" "checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b42e15e59b18a828bbf5c58ea01debb36b9b096346de35d941dcb89009f24a0d" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "076a696fdea89c19d3baed462576b8f6d663064414b5c793642da8dfeb99475b" +"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" -"checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" +"checksum serde_urlencoded 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" @@ -1355,8 +1467,7 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" -"checksum termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a8fb22f7cde82c8220e5aeacb3258ed7ce996142c77cba193f203515e26c330" +"checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" @@ -1371,28 +1482,29 @@ dependencies = [ "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" "checksum tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "90ca01319dea1e376a001e8dc192d42ebde6dd532532a5bad988ac37db365b19" "checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e" -"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" -"checksum tungstenite 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a9147f2f36ff21f9582ad10315172a14fdc3f3042ac12d302f61f7f2375926b" -"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum tungstenite 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "577caf571708961603baf59d2e148d12931e0da2e4bb6c5b471dd4a524fef3aa" +"checksum twoway 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" +"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" "checksum unchecked-index 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" "checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" -"checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6" +"checksum unicase 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2e2e6bd1e59e56598518beb94fd6db628ded570326f0a98c679a304bd9f00150" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" +"checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" "checksum urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3df3561629a8bb4c57e5a2e4c43348d9e29c7c29d9b1c4c1f47166deca8f37ed" "checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" -"checksum warp 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a120bf7041d4381a5429c4e6d12633bfb874c968a78ec3a3563e9ca6e12d6" +"checksum warp 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3921463c44f680d24f1273ea55efd985f31206a22a02dee207a2ec72684285ca" +"checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" "checksum weak-table 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a5862bb244c852a56c6f3c39668ff181271bda44513ef30d2073a3eedd9898d" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index cce806f..55d7a7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,13 +7,13 @@ edition = "2018" [dependencies] bytes = "0.4.12" clap = "2.33.0" -custom_error = "1.6.0" -futures = "0.1.28" -http = "0.1.17" -hyper = "0.12.31" +custom_error = "1.7" +futures = "0.1.29" +http = "0.1.18" +hyper = "0.12.35" odds = { version = "0.3.1", features = ["std-vec"] } tokio = "0.1.22" tokio-codec = "0.1.1" tokio-io = "0.1.12" -warp = "0.1.16" +warp = "0.1.20" weak-table = "0.2.3" From 03ee74b6dae3562785b6bbdedf45d9994de417d6 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 23 Sep 2019 16:34:28 -0400 Subject: [PATCH 02/29] Fix dyn syntax warning. --- src/commands/filter.rs | 2 +- src/commands/send.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/filter.rs b/src/commands/filter.rs index 55c9ee4..0aa0cfc 100644 --- a/src/commands/filter.rs +++ b/src/commands/filter.rs @@ -27,7 +27,7 @@ pub fn options() -> App<'static, 'static> { } pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { - let mut chunk_stream: Box + Send> = Box::new( + let mut chunk_stream: Box + Send> = Box::new( stdin_stream() .parse_ebml() .chunk_webm() diff --git a/src/commands/send.rs b/src/commands/send.rs index a16adee..5009a9e 100644 --- a/src/commands/send.rs +++ b/src/commands/send.rs @@ -34,7 +34,7 @@ pub fn options() -> App<'static, 'static> { .help("Slow down upload to \"real time\" speed as determined by the timestamps (useful for streaming static files)")) } -type BoxedChunkStream = Box + Send>; +type BoxedChunkStream = Box + Send>; pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { let mut chunk_stream: BoxedChunkStream = Box::new( From 90469e3fbd08568ff08134b480ecec5a04718a38 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Tue, 8 Oct 2019 21:44:23 -0400 Subject: [PATCH 03/29] Bring in futures-preview to begin porting to core futures. --- Cargo.lock | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + 2 files changed, 77 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 1630f7f..460e891 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -223,6 +223,20 @@ name = "futures" version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures-channel-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-core-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "futures-cpupool" version = "0.1.8" @@ -232,6 +246,54 @@ dependencies = [ "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "futures-executor-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-io-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-executor-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "futures-sink-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "futures-util-preview" +version = "0.3.0-alpha.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -640,6 +702,11 @@ dependencies = [ "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pin-utils" +version = "0.1.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "ppv-lite86" version = "0.2.5" @@ -1304,6 +1371,7 @@ dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "custom_error 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1383,7 +1451,14 @@ dependencies = [ "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)" = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +"checksum futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d5e5f4df964fa9c1c2f8bddeb5c3611631cacd93baf810fc8bb2fb4b495c263a" +"checksum futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "b35b6263fb1ef523c3056565fa67b1d16f0a8604ff12b11b08c25f28a734c60a" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum futures-executor-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "75236e88bd9fe88e5e8bfcd175b665d0528fe03ca4c5207fabc028c8f9d93e98" +"checksum futures-io-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "f4914ae450db1921a56c91bde97a27846287d062087d4a652efc09bb3a01ebda" +"checksum futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3b1dce2a0267ada5c6ff75a8ba864b4e679a9e2aa44262af7a3b5516d530d76e" +"checksum futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "86f148ef6b69f75bb610d4f9a2336d4fc88c4b5b67129d1a340dd0fd362efeec" +"checksum futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)" = "5ce968633c17e5f97936bd2797b6e38fb56cf16a7422319f7ec2e30d3c470e8d" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571" "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" @@ -1428,6 +1503,7 @@ dependencies = [ "checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" +"checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" diff --git a/Cargo.toml b/Cargo.toml index 55d7a7e..7b23c98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ bytes = "0.4.12" clap = "2.33.0" custom_error = "1.7" futures = "0.1.29" +futures3 = { package = "futures-preview", version="0.3.0-alpha", features = ["compat"] } http = "0.1.18" hyper = "0.12.35" odds = { version = "0.3.1", features = ["std-vec"] } From 5cd28a6cdc6b6cb82cd4501a864dd8e05ba78cef Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Tue, 8 Oct 2019 21:44:37 -0400 Subject: [PATCH 04/29] use core Never type --- src/channel.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index c5e6e01..ed10c5f 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -14,12 +14,11 @@ use futures::{ Receiver } }; +use futures3::Never; use odds::vec::VecExt; use crate::chunk::Chunk; -pub enum Never {} - /// A collection of listeners to a stream of WebM chunks. /// Sending a chunk may fail due to a client being disconnected, /// or simply failing to keep up with the stream buffer. In either From cfb56f128197a9e0163caa1a7d3099aa4b32a5b0 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Tue, 8 Oct 2019 23:35:13 -0400 Subject: [PATCH 05/29] Convert channel.rs to futures-preview --- src/channel.rs | 64 ++++++++++++++++++++++++++++++------------- src/commands/relay.rs | 14 ++++++++-- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index ed10c5f..9e901de 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -1,20 +1,23 @@ +use std::pin::Pin; +use std::task::{ + Context, + Poll +}; use std::sync::{ Arc, Mutex }; -use futures::{ - Async, - AsyncSink, - Sink, - Stream, - sync::mpsc::{ +use futures3::{ + channel::mpsc::{ channel as mpsc_channel, Sender, Receiver - } + }, + Sink, + Stream, + Never }; -use futures3::Never; use odds::vec::VecExt; use crate::chunk::Chunk; @@ -54,11 +57,14 @@ impl Transmitter { } } -impl Sink for Transmitter { - type SinkItem = Chunk; - type SinkError = Never; // never errors, slow clients are simply dropped +impl Sink for Transmitter { + type Error = Never; // never errors, slow clients are simply dropped - fn start_send(&mut self, chunk: Chunk) -> Result, Never> { + fn poll_ready(self: Pin<&mut Self>, _cx: &mut Context) -> Poll> { + Poll::Ready(Ok(())) + } + + fn start_send(self: Pin<&mut Self>, chunk: Chunk) -> Result<(), Never> { let mut channel = self.channel.lock().expect("Locking channel"); if let Chunk::Headers { .. } = chunk { @@ -67,14 +73,34 @@ impl Sink for Transmitter { channel.listeners.retain_mut(|listener| listener.start_send(chunk.clone()).is_ok()); - Ok(AsyncSink::Ready) + Ok(()) } - fn poll_complete(&mut self) -> Result, Never> { + + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let mut channel = self.channel.lock().expect("Locking channel"); + let mut result = Poll::Ready(Ok(())); + + // just disconnect any erroring listeners + channel.listeners.retain_mut(|listener| match Pin::new(listener).poll_flush(cx) { + Poll::Pending => {result = Poll::Pending; true}, + Poll::Ready(Ok(())) => true, + Poll::Ready(Err(_)) => false, + }); + + result + } + + fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { let mut channel = self.channel.lock().expect("Locking channel"); - channel.listeners.retain_mut(|listener| listener.poll_complete().is_ok()); + // there's no useful error we can offer here, just give everything a chance to try closing + channel.listeners.retain_mut(|listener| Pin::new(listener).poll_close(cx).is_pending()); - Ok(Async::Ready(())) + return if channel.listeners.len() > 0 { + Poll::Pending + } else { + Poll::Ready(Ok(())) + } } } @@ -107,9 +133,9 @@ impl Listener { impl Stream for Listener { type Item = Chunk; - type Error = Never; // no transmitter errors are exposed to the listeners - fn poll(&mut self) -> Result>, Never> { - Ok(self.receiver.poll().expect("Channel receiving can't error")) + fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { + let receiver = &mut self.get_mut().receiver; + Pin::new(receiver).poll_next(cx) } } diff --git a/src/commands/relay.rs b/src/commands/relay.rs index bae0a6e..302fe38 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -13,6 +13,14 @@ use futures::{ Sink, stream::empty }; +use futures3::{ + compat::{ + Compat, + CompatSink, + }, + Never, + StreamExt +}; use hyper::{ Body, Response, @@ -45,11 +53,11 @@ use webmetro::{ const BUFFER_LIMIT: usize = 2 * 1024 * 1024; fn get_stream(channel: Handle) -> impl Stream { - Listener::new(channel) + Compat::new(Listener::new(channel).map(|c| Ok(c))) .fix_timecodes() .find_starting_point() .map(|webm_chunk| webm_chunk.into_bytes()) - .map_err(|err| match err {}) + .map_err(|err: Never| match err {}) } fn post_stream(channel: Handle, stream: impl Stream) -> impl Stream { @@ -57,7 +65,7 @@ fn post_stream(channel: Handle, stream: impl Stream WebmetroError {match err {}})) .into_stream() From 3a6ca629ca60924278b5cf10f96b78eecbc0c2ba Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Fri, 11 Oct 2019 00:28:08 -0400 Subject: [PATCH 06/29] Use core futures for the fixers; try different approach to timecode fixer --- Cargo.lock | 285 +++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/commands/filter.rs | 14 +- src/commands/relay.rs | 15 ++- src/commands/send.rs | 14 +- src/fixers.rs | 100 ++++++++------- 6 files changed, 371 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 460e891..80164a3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -127,6 +127,14 @@ dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "crossbeam-channel" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam-deque" version = "0.7.1" @@ -458,6 +466,9 @@ dependencies = [ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "libc" @@ -473,6 +484,14 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lock_api" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "scopeguard 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.3.9" @@ -650,6 +669,16 @@ dependencies = [ "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "parking_lot_core" version = "0.4.0" @@ -662,6 +691,20 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parking_lot_core" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -702,6 +745,24 @@ dependencies = [ "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pin-project" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "pin-project-internal 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "pin-utils" version = "0.1.0-alpha.4" @@ -712,11 +773,27 @@ name = "ppv-lite86" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "proc-macro2" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.6.5" @@ -982,6 +1059,11 @@ name = "smallvec" version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "stable_deref_trait" version = "1.1.1" @@ -1000,6 +1082,16 @@ name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "syn" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tempfile" version = "3.1.0" @@ -1054,6 +1146,27 @@ dependencies = [ "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-macros 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-net 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.3.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-buf" version = "0.1.1" @@ -1074,6 +1187,18 @@ dependencies = [ "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-codec" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-current-thread" version = "0.1.6" @@ -1092,6 +1217,24 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-executor" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-fs" version = "0.1.6" @@ -1102,6 +1245,19 @@ dependencies = [ "tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-fs" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-io" version = "0.1.12" @@ -1112,6 +1268,52 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-io" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-macros" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-net" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-reactor" version = "0.1.9" @@ -1139,6 +1341,17 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-sync" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-tcp" version = "0.1.3" @@ -1179,6 +1392,19 @@ dependencies = [ "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-timer" +version = "0.3.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-udp" version = "0.1.5" @@ -1210,6 +1436,36 @@ dependencies = [ "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tracing" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-attributes 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tracing-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "try-lock" version = "0.2.2" @@ -1288,6 +1544,11 @@ name = "unicode-width" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "2.1.0" @@ -1376,6 +1637,7 @@ dependencies = [ "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "warp 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1437,6 +1699,7 @@ dependencies = [ "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa" "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" "checksum crossbeam-epoch 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fedcd6772e37f3da2a9af9bf12ebe046c0dfe657992377b4df982a2b54cd37a9" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" @@ -1477,6 +1740,7 @@ dependencies = [ "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum lock_api 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8912e782533a93a167888781b836336a6ca5da6175c05944c86cf28c31104dc" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" @@ -1497,15 +1761,21 @@ dependencies = [ "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab41b4aed082705d1056416ae4468b6ea99d52599ecf3169b00088d43113e337" +"checksum parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" +"checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18" "checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e" "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" +"checksum pin-project 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3d9156ea5979ae30ecc0460cd848738daf24cfb89eb11a41e0c369ba1f0e6aeb" +"checksum pin-project-internal 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1a375fffcd7bf53d8302fb95c1e2f3e0a1a92bd57edcab796f26f9e527c2f3da" "checksum pin-utils 0.1.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" "checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" +"checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" "checksum rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae1b169243eaf61759b8475a998f0a385e42042370f3a7dbaf35246eacc8412" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" @@ -1540,26 +1810,40 @@ dependencies = [ "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" +"checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" +"checksum tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1f17f5d6ab0f35c1506678b28fb1798bdf74fcb737e9843c7b17b73e426eba38" "checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-codec 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9f5d22fd1e84bd4045d28813491cb7d7caae34d45c80517c2213f09a85e8787a" "checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" "checksum tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f27ee0e6db01c5f0b2973824547ce7e637b2ed79b891a9677b0de9bd532b6ac" +"checksum tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9ee9ceecf69145923834ea73f32ba40c790fd877b74a7817dd0b089f1eb9c7c8" "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" +"checksum tokio-fs 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0bf85e16971e06e680c622e0c1b455be94b086275c5ddcd6d4a83a2bfbb83cda" "checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" +"checksum tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "112784d5543df30660b04a72ca423bfbd90e8bb32f94dcf610f15401218b22c5" +"checksum tokio-macros 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "86b616374bcdadd95974e1f0dfca07dc913f1163c53840c0d664aca35114964e" +"checksum tokio-net 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "a441682cd32f3559383112c4a7f372f5c9fa1950c5cf8c8dd05274a2ce8c2654" "checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" "checksum tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2162248ff317e2bc713b261f242b69dbb838b85248ed20bb21df56d60ea4cae7" +"checksum tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "4f1aaeb685540f7407ea0e27f1c9757d258c7c6bf4e3eb19da6fc59b747239d2" "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" "checksum tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "90ca01319dea1e376a001e8dc192d42ebde6dd532532a5bad988ac37db365b19" "checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e" +"checksum tokio-timer 0.3.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b97c1587fe71018eb245a4a9daa13a5a3b681bbc1f7fdadfe24720e141472c13" "checksum tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum tracing 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c21ff9457accc293386c20e8f754d0b059e67e325edf2284f04230d125d7e5ff" +"checksum tracing-attributes 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff978fd9c9afe2cc9c671e247713421c6406b3422305cbdce5de695d3ab4c3c" +"checksum tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "528c8ebaaa16cdac34795180b046c031775b0d56402704d98c096788f33d646a" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" "checksum tungstenite 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "577caf571708961603baf59d2e148d12931e0da2e4bb6c5b471dd4a524fef3aa" "checksum twoway 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" @@ -1570,6 +1854,7 @@ dependencies = [ "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" "checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "75b414f6c464c879d7f9babf951f23bc3743fb7313c081b2e6ca719067ea9d61" "checksum urlencoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3df3561629a8bb4c57e5a2e4c43348d9e29c7c29d9b1c4c1f47166deca8f37ed" "checksum utf-8 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "05e42f7c18b8f902290b009cde6d651262f956c98bc51bca4cd1d511c9cd85c7" diff --git a/Cargo.toml b/Cargo.toml index 7b23c98..ccbfe32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ http = "0.1.18" hyper = "0.12.35" odds = { version = "0.3.1", features = ["std-vec"] } tokio = "0.1.22" +tokio2 = { package = "tokio", version="0.2.0-alpha.6" } tokio-codec = "0.1.1" tokio-io = "0.1.12" warp = "0.1.20" diff --git a/src/commands/filter.rs b/src/commands/filter.rs index 0aa0cfc..c5d907d 100644 --- a/src/commands/filter.rs +++ b/src/commands/filter.rs @@ -5,6 +5,10 @@ use std::{ use clap::{App, Arg, ArgMatches, SubCommand}; use futures::prelude::*; +use futures3::compat::{ + Compat, + Compat01As03 +}; use tokio::runtime::Runtime; use super::stdin_stream; @@ -14,7 +18,10 @@ use webmetro::{ WebmStream }, error::WebmetroError, - fixers::ChunkStream, + fixers::{ + ChunkStream, + ChunkTimecodeFixer, + }, stream_parser::StreamEbml }; @@ -27,15 +34,16 @@ pub fn options() -> App<'static, 'static> { } pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { + let mut timecode_fixer = ChunkTimecodeFixer::new(); let mut chunk_stream: Box + Send> = Box::new( stdin_stream() .parse_ebml() .chunk_webm() - .fix_timecodes() + .map(move |chunk| timecode_fixer.process(chunk)) ); if args.is_present("throttle") { - chunk_stream = Box::new(chunk_stream.throttle()); + chunk_stream = Box::new(Compat::new(Compat01As03::new(chunk_stream).throttle())); } Runtime::new().unwrap().block_on(chunk_stream.for_each(|chunk| { diff --git a/src/commands/relay.rs b/src/commands/relay.rs index 302fe38..ae4820c 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -19,6 +19,7 @@ use futures3::{ CompatSink, }, Never, + prelude::*, StreamExt }; use hyper::{ @@ -46,18 +47,22 @@ use webmetro::{ }, chunk::WebmStream, error::WebmetroError, - fixers::ChunkStream, + fixers::{ + ChunkStream, + ChunkTimecodeFixer, + }, stream_parser::StreamEbml }; const BUFFER_LIMIT: usize = 2 * 1024 * 1024; fn get_stream(channel: Handle) -> impl Stream { - Compat::new(Listener::new(channel).map(|c| Ok(c))) - .fix_timecodes() + let mut timecode_fixer = ChunkTimecodeFixer::new(); + Compat::new(Listener::new(channel).map(|c| Ok(c)) + .map_ok(move |chunk| timecode_fixer.process(chunk)) .find_starting_point() - .map(|webm_chunk| webm_chunk.into_bytes()) - .map_err(|err: Never| match err {}) + .map_ok(|webm_chunk| webm_chunk.into_bytes()) + .map_err(|err: Never| match err {})) } fn post_stream(channel: Handle, stream: impl Stream) -> impl Stream { diff --git a/src/commands/send.rs b/src/commands/send.rs index 5009a9e..4bf9fa3 100644 --- a/src/commands/send.rs +++ b/src/commands/send.rs @@ -2,6 +2,10 @@ use clap::{App, Arg, ArgMatches, SubCommand}; use futures::{ prelude::* }; +use futures3::compat::{ + Compat, + Compat01As03 +}; use hyper::{ Body, Client, @@ -19,7 +23,10 @@ use webmetro::{ WebmStream }, error::WebmetroError, - fixers::ChunkStream, + fixers::{ + ChunkStream, + ChunkTimecodeFixer, + }, stream_parser::StreamEbml }; @@ -37,11 +44,12 @@ pub fn options() -> App<'static, 'static> { type BoxedChunkStream = Box + Send>; pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { + let mut timecode_fixer = ChunkTimecodeFixer::new(); let mut chunk_stream: BoxedChunkStream = Box::new( stdin_stream() .parse_ebml() .chunk_webm() - .fix_timecodes() + .map(move |chunk| timecode_fixer.process(chunk)) ); let url_str = match args.value_of("url") { @@ -50,7 +58,7 @@ pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { }; if args.is_present("throttle") { - chunk_stream = Box::new(chunk_stream.throttle()); + chunk_stream = Box::new(Compat::new(Compat01As03::new(chunk_stream).throttle())); } let request_payload = Body::wrap_stream(chunk_stream.map( diff --git a/src/fixers.rs b/src/fixers.rs index aeac505..f134b73 100644 --- a/src/fixers.rs +++ b/src/fixers.rs @@ -1,27 +1,36 @@ +use std::pin::Pin; +use std::task::{ + Context, + Poll +}; use std::time::{Duration, Instant}; -use futures::prelude::*; -use tokio::timer::Delay; +use futures3::prelude::*; +use tokio2::timer::{ + delay, + Delay +}; use crate::chunk::Chunk; use crate::error::WebmetroError; -pub struct ChunkTimecodeFixer { - stream: S, +pub struct ChunkTimecodeFixer { current_offset: u64, last_observed_timecode: u64, assumed_duration: u64 } -impl> Stream for ChunkTimecodeFixer -{ - type Item = S::Item; - type Error = S::Error; - - fn poll(&mut self) -> Result>, Self::Error> { - let mut poll_chunk = self.stream.poll(); - match poll_chunk { - Ok(Async::Ready(Some(Chunk::ClusterHead(ref mut cluster_head)))) => { +impl ChunkTimecodeFixer { + pub fn new() -> ChunkTimecodeFixer { + ChunkTimecodeFixer { + current_offset: 0, + last_observed_timecode: 0, + assumed_duration: 33 + } + } + pub fn process<'a>(&mut self, mut chunk: Chunk) -> Chunk { + match chunk { + Chunk::ClusterHead(ref mut cluster_head) => { let start = cluster_head.start; if start < self.last_observed_timecode { let next_timecode = self.last_observed_timecode + self.assumed_duration; @@ -30,10 +39,10 @@ impl> Stream for ChunkTimecodeFixer cluster_head.update_timecode(start + self.current_offset); self.last_observed_timecode = cluster_head.end; - }, + } _ => {} - }; - poll_chunk + } + chunk } } @@ -43,33 +52,32 @@ pub struct StartingPointFinder { seen_keyframe: bool } -impl> Stream for StartingPointFinder +impl + Unpin> Stream for StartingPointFinder { - type Item = S::Item; - type Error = S::Error; + type Item = Result; - fn poll(&mut self) -> Result>, Self::Error> { + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll>> { loop { - return match self.stream.poll() { - Ok(Async::Ready(Some(Chunk::ClusterHead(cluster_head)))) => { + return match self.stream.try_poll_next_unpin(cx) { + Poll::Ready(Some(Ok(Chunk::ClusterHead(cluster_head)))) => { if cluster_head.keyframe { self.seen_keyframe = true; } if self.seen_keyframe { - Ok(Async::Ready(Some(Chunk::ClusterHead(cluster_head)))) + Poll::Ready(Some(Ok(Chunk::ClusterHead(cluster_head)))) } else { continue; } }, - chunk @ Ok(Async::Ready(Some(Chunk::ClusterBody {..}))) => { + chunk @ Poll::Ready(Some(Ok(Chunk::ClusterBody {..}))) => { if self.seen_keyframe { chunk } else { continue; } }, - chunk @ Ok(Async::Ready(Some(Chunk::Headers {..}))) => { + chunk @ Poll::Ready(Some(Ok(Chunk::Headers {..}))) => { if self.seen_header { // new stream starting, we don't need a new header but should wait for a safe spot to resume self.seen_keyframe = false; @@ -91,37 +99,35 @@ pub struct Throttle { sleep: Delay } -impl> Stream for Throttle +impl + Unpin> Stream for Throttle { - type Item = S::Item; - type Error = WebmetroError; + type Item = Result; - fn poll(&mut self) -> Result>, WebmetroError> { - match self.sleep.poll() { - Err(err) => return Err(err.into()), - Ok(Async::NotReady) => return Ok(Async::NotReady), - Ok(Async::Ready(())) => { /* can continue */ } + fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll>> { + match self.sleep.poll_unpin(cx) { + Poll::Pending => return Poll::Pending, + Poll::Ready(()) => { /* can continue */ }, } - let next_chunk = self.stream.poll(); - if let Ok(Async::Ready(Some(Chunk::ClusterHead(ref cluster_head)))) = next_chunk { + let next_chunk = self.stream.try_poll_next_unpin(cx); + if let Poll::Ready(Some(Ok(Chunk::ClusterHead(ref cluster_head)))) = next_chunk { // snooze until real time has "caught up" to the stream let offset = Duration::from_millis(cluster_head.end); - self.sleep.reset(self.start_time + offset); + let sleep_until = self.start_time + offset; + self.sleep.reset(sleep_until); } next_chunk } } -pub trait ChunkStream where Self : Sized + Stream { - fn fix_timecodes(self) -> ChunkTimecodeFixer { - ChunkTimecodeFixer { - stream: self, - current_offset: 0, - last_observed_timecode: 0, - assumed_duration: 33 - } - } +pub trait ChunkStream where Self : Sized + TryStream { + /*fn fix_timecodes(self) -> Map<_> { + let fixer = ; + self.map(move |chunk| { + fixer.process(chunk); + chunk + }) + }*/ fn find_starting_point(self) -> StartingPointFinder { StartingPointFinder { @@ -136,9 +142,9 @@ pub trait ChunkStream where Self : Sized + Stream { Throttle { stream: self, start_time: now, - sleep: Delay::new(now) + sleep: delay(now) } } } -impl> ChunkStream for T {} +impl> ChunkStream for T {} From 49fa0ff7e0e232eca3cfacb7930a8b99b0486863 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Tue, 15 Oct 2019 23:36:23 -0400 Subject: [PATCH 07/29] make error descriptions more useful --- src/error.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/error.rs b/src/error.rs index 9d29a86..2e40750 100644 --- a/src/error.rs +++ b/src/error.rs @@ -3,12 +3,12 @@ use custom_error::custom_error; custom_error!{pub WebmetroError ResourcesExceeded = "resources exceeded", - EbmlError{source: crate::ebml::EbmlError} = "EBML error", - HttpError{source: http::Error} = "HTTP error", - HyperError{source: hyper::Error} = "Hyper error", - IoError{source: std::io::Error} = "IO error", - TimerError{source: tokio::timer::Error} = "Timer error", - WarpError{source: warp::Error} = "Warp error", + EbmlError{source: crate::ebml::EbmlError} = "EBML error: {source}", + HttpError{source: http::Error} = "HTTP error: {source}", + HyperError{source: hyper::Error} = "Hyper error: {source}", + IoError{source: std::io::Error} = "IO error: {source}", + TimerError{source: tokio::timer::Error} = "Timer error: {source}", + WarpError{source: warp::Error} = "Warp error: {source}", ApplicationError{message: String} = "{message}" } From 8a3f478c386828e0ad3b7617aab46d7043726d71 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Wed, 16 Oct 2019 00:16:47 -0400 Subject: [PATCH 08/29] Give Throttle a ::new() function for now --- src/fixers.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/fixers.rs b/src/fixers.rs index f134b73..dbbba52 100644 --- a/src/fixers.rs +++ b/src/fixers.rs @@ -99,6 +99,17 @@ pub struct Throttle { sleep: Delay } +impl Throttle { + pub fn new(wrap: S) -> Throttle { + let now = Instant::now(); + Throttle { + stream: wrap, + start_time: now, + sleep: delay(now) + } + } +} + impl + Unpin> Stream for Throttle { type Item = Result; @@ -138,12 +149,7 @@ pub trait ChunkStream where Self : Sized + TryStream { } fn throttle(self) -> Throttle { - let now = Instant::now(); - Throttle { - stream: self, - start_time: now, - sleep: delay(now) - } + Throttle::new(self) } } From ccbb566d850800082ccd485371c4e325a23e790f Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Wed, 16 Oct 2019 23:53:09 -0400 Subject: [PATCH 09/29] Remove unused module --- src/lib.rs | 1 - src/slice.rs | 18 ------------------ 2 files changed, 19 deletions(-) delete mode 100644 src/slice.rs diff --git a/src/lib.rs b/src/lib.rs index e11055c..64e234c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ pub mod ebml; pub mod error; pub mod iterator; -pub mod slice; pub mod stream_parser; pub mod chunk; diff --git a/src/slice.rs b/src/slice.rs deleted file mode 100644 index 8d621cf..0000000 --- a/src/slice.rs +++ /dev/null @@ -1,18 +0,0 @@ -use futures::Async; - -use crate::ebml::EbmlError; -use crate::ebml::EbmlEventSource; -use crate::ebml::FromEbml; - -pub struct EbmlSlice<'a>(pub &'a [u8]); - -impl<'b> EbmlEventSource for EbmlSlice<'b> { - type Error = EbmlError; - - fn poll_event<'a, T: FromEbml<'a>>(&'a mut self) -> Result>, EbmlError> { - T::decode_element(self.0).map(|option| option.map(|(element, element_size)| { - self.0 = &self.0[element_size..]; - element - })).map(Async::Ready) - } -} From e1aeeb81060f7c80369b899068db8a3d7ba71fde Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Wed, 16 Oct 2019 23:53:21 -0400 Subject: [PATCH 10/29] pin to nightly for now --- rust-toolchain | 1 + 1 file changed, 1 insertion(+) create mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..bf867e0 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly From d894a139f2c6b117162905b68456ee443d13741e Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Sun, 20 Oct 2019 00:14:06 -0400 Subject: [PATCH 11/29] make return value for check_space more structured/informative --- src/ebml.rs | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/ebml.rs b/src/ebml.rs index a896ec2..1184669 100644 --- a/src/ebml.rs +++ b/src/ebml.rs @@ -197,6 +197,12 @@ pub fn encode_integer(tag: u64, value: u64, output: &mut T) -> IoResul output.write_all(&buffer.get_ref()[..]) } +pub struct EbmlLayout { + element_id: u64, + body_offset: usize, + element_len: usize, +} + pub trait FromEbml<'a>: Sized { /// Indicates if this tag's contents should be treated as a blob, /// or if the tag header should be reported as an event and with further @@ -210,13 +216,14 @@ pub trait FromEbml<'a>: Sized { /// references into the given buffer. fn decode(element_id: u64, bytes: &'a[u8]) -> Result; - /// Check if enough space exists in the given buffer for decode_element() to - /// be successful; parsing errors will be returned eagerly. - fn check_space(bytes: &[u8]) -> Result, EbmlError> { + /// Check if enough space exists in the given buffer to decode an element; + /// it will not actually call `decode` or try to construct an instance, + /// but EBML errors with the next tag header will be returned eagerly. + fn check_space(bytes: &[u8]) -> Result, EbmlError> { match decode_tag(bytes) { Ok(None) => Ok(None), Err(err) => Err(err), - Ok(Some((element_id, payload_size_tag, tag_size))) => { + Ok(Some((element_id, payload_size_tag, body_offset))) => { let should_unwrap = Self::should_unwrap(element_id); let payload_size = match (should_unwrap, payload_size_tag) { @@ -225,12 +232,16 @@ pub trait FromEbml<'a>: Sized { (false, Varint::Value(size)) => size as usize }; - let element_size = tag_size + payload_size; - if element_size > bytes.len() { + let element_len = body_offset + payload_size; + if element_len > bytes.len() { // need to read more still Ok(None) } else { - Ok(Some(element_size)) + Ok(Some(EbmlLayout { + element_id, + body_offset, + element_len + })) } } } From a9b66b62978d8d7748ed5489cec946b2cbebb009 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Sun, 20 Oct 2019 00:25:35 -0400 Subject: [PATCH 12/29] Remove repeated code in `decode_element` --- src/ebml.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/ebml.rs b/src/ebml.rs index 1184669..5815591 100644 --- a/src/ebml.rs +++ b/src/ebml.rs @@ -249,26 +249,11 @@ pub trait FromEbml<'a>: Sized { /// Attempt to construct an instance of this type from the given byte slice fn decode_element(bytes: &'a[u8]) -> Result, EbmlError> { - match decode_tag(bytes) { - Ok(None) => Ok(None), - Err(err) => Err(err), - Ok(Some((element_id, payload_size_tag, tag_size))) => { - let should_unwrap = Self::should_unwrap(element_id); - - let payload_size = match (should_unwrap, payload_size_tag) { - (true, _) => 0, - (false, Varint::Unknown) => return Err(EbmlError::UnknownElementLength), - (false, Varint::Value(size)) => size as usize - }; - - let element_size = tag_size + payload_size; - if element_size > bytes.len() { - // need to read more still - return Ok(None); - } - - match Self::decode(element_id, &bytes[tag_size..element_size]) { - Ok(element) => Ok(Some((element, element_size))), + match Self::check_space(bytes)? { + None => Ok(None), + Some(info) => { + match Self::decode(info.element_id, &bytes[info.body_offset..info.element_len]) { + Ok(element) => Ok(Some((element, info.element_len))), Err(error) => Err(error) } } From 710af7e1d7a02573e63fd91b7d0ec5e0269ef2c4 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Sat, 19 Oct 2019 16:37:56 -0400 Subject: [PATCH 13/29] feeder-based parser proof-of-concept adjusted to work with the lifetime FromEbml trait --- Cargo.lock | 1 + Cargo.toml | 1 + src/async_parser.rs | 108 ++++++++++++++++++++++++++++++++++++++++++++ src/ebml.rs | 6 +-- src/lib.rs | 2 + 5 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 src/async_parser.rs diff --git a/Cargo.lock b/Cargo.lock index 80164a3..20eb6ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1635,6 +1635,7 @@ dependencies = [ "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index ccbfe32..28195e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ futures = "0.1.29" futures3 = { package = "futures-preview", version="0.3.0-alpha", features = ["compat"] } http = "0.1.18" hyper = "0.12.35" +matches = "0.1.8" odds = { version = "0.3.1", features = ["std-vec"] } tokio = "0.1.22" tokio2 = { package = "tokio", version="0.2.0-alpha.6" } diff --git a/src/async_parser.rs b/src/async_parser.rs new file mode 100644 index 0000000..e650ddb --- /dev/null +++ b/src/async_parser.rs @@ -0,0 +1,108 @@ +use bytes::{Bytes, BytesMut}; +use std::future::Future; + +use crate::ebml::FromEbml; +use crate::error::WebmetroError; + +#[derive(Default)] +pub struct EbmlParser { + buffer: BytesMut, + buffer_size_limit: Option, + borrowed: Bytes +} + +impl EbmlParser { + /// add a "soft" buffer size limit; if the input buffer exceeds this size, + /// error the stream instead of resuming. It's still possible for the buffer + /// to exceed this size *after* a fill, so ensure input sizes are reasonable. + pub fn with_soft_limit(mut self, limit: usize) -> Self { + self.buffer_size_limit = Some(limit); + self + } + + pub fn feed(&mut self, bytes: impl AsRef<[u8]>) { + self.buffer.extend_from_slice(bytes.as_ref()) + } + + pub fn next_element<'a, T: FromEbml<'a>>(&'a mut self) -> Result, WebmetroError> { + Ok(match T::check_space(&self.buffer)? { + None => None, + Some(info) => { + let mut bytes = self.buffer.split_to(info.element_len).freeze(); + bytes.advance(info.body_offset); + self.borrowed = bytes; + Some(T::decode(info.element_id, &self.borrowed)?) + } + }) + } + + pub async fn next_element_with_feeder< + 'a, + T: FromEbml<'a>, + F: FnMut() -> Fut, + Fut: Future>, + >( + &'a mut self, + mut feeder: F, + ) -> Result, WebmetroError> { + loop { + if let Some(_) = T::check_space(&self.buffer)? { + return self.next_element(); + } + + if let Some(limit) = self.buffer_size_limit { + if limit <= self.buffer.len() { + // hit our buffer limit and still nothing parsed + return Err(WebmetroError::ResourcesExceeded); + } + } + + self.buffer.extend(feeder().await?); + } + } +} + +#[cfg(test)] +mod tests { + use matches::assert_matches; + + use crate::async_parser::*; + use crate::tests::ENCODE_WEBM_TEST_FILE; + use crate::webm::*; + + #[test] + fn async_webm_test() { + let pieces = vec![ + &ENCODE_WEBM_TEST_FILE[0..20], + &ENCODE_WEBM_TEST_FILE[20..40], + &ENCODE_WEBM_TEST_FILE[40..], + ]; + + let mut piece_iter = pieces.iter(); + + let result: Result<_, WebmetroError> = futures3::executor::block_on(async { + let mut next = || { + let result = if let Some(bytes) = piece_iter.next() { + Ok(Bytes::from(*bytes)) + } else { + Err("End of input".into()) + }; + async { result } + }; + + let mut parser = EbmlParser::default(); + + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::EbmlHead)); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Segment)); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Tracks(_))); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Cluster)); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Timecode(0))); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::SimpleBlock(_))); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Cluster)); + assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Timecode(1000))); + + Ok(()) + }); + result.unwrap(); + } +} diff --git a/src/ebml.rs b/src/ebml.rs index 5815591..8844a5f 100644 --- a/src/ebml.rs +++ b/src/ebml.rs @@ -198,9 +198,9 @@ pub fn encode_integer(tag: u64, value: u64, output: &mut T) -> IoResul } pub struct EbmlLayout { - element_id: u64, - body_offset: usize, - element_len: usize, + pub element_id: u64, + pub body_offset: usize, + pub element_len: usize, } pub trait FromEbml<'a>: Sized { diff --git a/src/lib.rs b/src/lib.rs index 64e234c..84a89d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,8 @@ pub mod ebml; pub mod error; + +pub mod async_parser; pub mod iterator; pub mod stream_parser; From 4a0bf8ee8c200ac296ae851837cb0ff7a0843a8c Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 00:03:30 -0400 Subject: [PATCH 14/29] Write a test for stream_parser --- src/stream_parser.rs | 56 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/stream_parser.rs b/src/stream_parser.rs index d9e4d0a..de70643 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -95,6 +95,58 @@ impl> EbmlEventSource for Ebm #[cfg(test)] mod tests { - //#[test] - + use bytes::IntoBuf; + use futures::prelude::*; + use futures::Async::*; + use matches::assert_matches; + + use crate::stream_parser::*; + use crate::tests::ENCODE_WEBM_TEST_FILE; + use crate::webm::*; + + #[test] + fn stream_webm_test() { + let pieces = vec![ + &ENCODE_WEBM_TEST_FILE[0..20], + &ENCODE_WEBM_TEST_FILE[20..40], + &ENCODE_WEBM_TEST_FILE[40..], + ]; + + let mut stream_parser = futures::stream::iter_ok(pieces.iter()) + .map(|bytes| bytes.into_buf()) + .parse_ebml(); + + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::EbmlHead))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::Segment))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::Tracks(_)))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::Cluster))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::Timecode(0)))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::SimpleBlock(_)))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::Cluster))) + ); + assert_matches!( + stream_parser.poll_event(), + Ok(Ready(Some(WebmElement::Timecode(1000)))) + ); + } } From fa85939c0bbf6691c15687e334d7f446cff03584 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 00:19:20 -0400 Subject: [PATCH 15/29] Cleanup stream_parser using some async_parser approaches --- src/stream_parser.rs | 71 ++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/src/stream_parser.rs b/src/stream_parser.rs index de70643..a4a02fa 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -1,24 +1,14 @@ -use bytes::{ - Buf, - BufMut, - BytesMut -}; -use futures::{ - Async, - stream::Stream -}; +use bytes::{Buf, BufMut, Bytes, BytesMut}; +use futures::{stream::Stream, Async}; -use crate::ebml::{ - EbmlEventSource, - FromEbml -}; +use crate::ebml::{EbmlEventSource, FromEbml}; use crate::error::WebmetroError; pub struct EbmlStreamingParser { stream: S, buffer: BytesMut, buffer_size_limit: Option, - last_read: usize + borrowed: Bytes, } impl EbmlStreamingParser { @@ -31,13 +21,17 @@ impl EbmlStreamingParser { } } -pub trait StreamEbml where Self: Sized + Stream, Self::Item: Buf { +pub trait StreamEbml +where + Self: Sized + Stream, + Self::Item: Buf, +{ fn parse_ebml(self) -> EbmlStreamingParser { EbmlStreamingParser { stream: self, buffer: BytesMut::new(), buffer_size_limit: None, - last_read: 0 + borrowed: Bytes::new(), } } } @@ -45,26 +39,23 @@ pub trait StreamEbml where Self: Sized + Stream, Self::Item: Buf { impl> StreamEbml for S {} impl> EbmlStreamingParser { - pub fn poll_event<'a, T: FromEbml<'a>>(&'a mut self) -> Result>, WebmetroError> { - // release buffer from previous event - self.buffer.advance(self.last_read); - self.last_read = 0; - + pub fn poll_event<'a, T: FromEbml<'a>>( + &'a mut self, + ) -> Result>, WebmetroError> { loop { - match T::check_space(&self.buffer) { - Ok(None) => { + match T::check_space(&self.buffer)? { + None => { // need to refill buffer, below - }, - other => return other.map_err(WebmetroError::from).and_then(move |_| { - match T::decode_element(&self.buffer) { - Err(err) => Err(err.into()), - Ok(None) => panic!("Buffer was supposed to have enough data to parse element, somehow did not."), - Ok(Some((element, element_size))) => { - self.last_read = element_size; - Ok(Async::Ready(Some(element))) - } - } - }) + } + Some(info) => { + let mut bytes = self.buffer.split_to(info.element_len).freeze(); + bytes.advance(info.body_offset); + self.borrowed = bytes; + return Ok(Async::Ready(Some(T::decode( + info.element_id, + &self.borrowed, + )?))); + } } if let Some(limit) = self.buffer_size_limit { @@ -73,19 +64,21 @@ impl> EbmlStreamingParser } } - match self.stream.poll() { - Ok(Async::Ready(Some(buf))) => { + match self.stream.poll()? { + Async::Ready(Some(buf)) => { self.buffer.reserve(buf.remaining()); self.buffer.put(buf); // ok can retry decoding now - }, - other => return other.map(|async_status| async_status.map(|_| None)) + } + other => return Ok(other.map(|_| None)), } } } } -impl> EbmlEventSource for EbmlStreamingParser { +impl> EbmlEventSource + for EbmlStreamingParser +{ type Error = WebmetroError; fn poll_event<'a, T: FromEbml<'a>>(&'a mut self) -> Result>, WebmetroError> { From eda2e4f7beb5db500f4a64218f496074ae213a9c Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 01:20:14 -0400 Subject: [PATCH 16/29] Remove EbmlEventSource trait in favor of concrete EbmlStreamingParser --- src/chunk.rs | 21 ++++++++++++--------- src/ebml.rs | 6 ------ src/stream_parser.rs | 12 +----------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/chunk.rs b/src/chunk.rs index 477e204..2813ce3 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -1,10 +1,10 @@ -use bytes::Bytes; +use bytes::{Buf, Bytes}; use futures::{Async, Stream}; use std::{ io::Cursor, mem }; -use crate::ebml::EbmlEventSource; +use crate::stream_parser::EbmlStreamingParser; use crate::error::WebmetroError; use crate::webm::*; @@ -103,7 +103,7 @@ enum ChunkerState { } pub struct WebmChunker { - source: S, + source: EbmlStreamingParser, buffer_size_limit: Option, state: ChunkerState } @@ -128,8 +128,7 @@ fn encode(element: WebmElement, buffer: &mut Cursor>, limit: Option Stream for WebmChunker -where S::Error: Into +impl> Stream for WebmChunker { type Item = Chunk; type Error = WebmetroError; @@ -266,8 +265,14 @@ where S::Error: Into } } -pub trait WebmStream where Self: Sized + EbmlEventSource { - fn chunk_webm(self) -> WebmChunker { +pub trait WebmStream { + type Stream; + fn chunk_webm(self) -> WebmChunker; +} + +impl WebmStream for EbmlStreamingParser { + type Stream = S; + fn chunk_webm(self) -> WebmChunker { WebmChunker { source: self, buffer_size_limit: None, @@ -276,8 +281,6 @@ pub trait WebmStream where Self: Sized + EbmlEventSource { } } -impl WebmStream for T {} - #[cfg(test)] mod tests { diff --git a/src/ebml.rs b/src/ebml.rs index 8844a5f..7eae90c 100644 --- a/src/ebml.rs +++ b/src/ebml.rs @@ -1,7 +1,6 @@ use bytes::{BigEndian, ByteOrder, BufMut}; use custom_error::custom_error; use std::io::{Cursor, Error as IoError, ErrorKind, Result as IoResult, Write, Seek, SeekFrom}; -use futures::Async; pub const EBML_HEAD_ID: u64 = 0x0A45DFA3; pub const DOC_TYPE_ID: u64 = 0x0282; @@ -261,11 +260,6 @@ pub trait FromEbml<'a>: Sized { } } -pub trait EbmlEventSource { - type Error; - fn poll_event<'a, T: FromEbml<'a>>(&'a mut self) -> Result>, Self::Error>; -} - #[cfg(test)] mod tests { use bytes::{BytesMut}; diff --git a/src/stream_parser.rs b/src/stream_parser.rs index a4a02fa..b0bfe20 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -1,7 +1,7 @@ use bytes::{Buf, BufMut, Bytes, BytesMut}; use futures::{stream::Stream, Async}; -use crate::ebml::{EbmlEventSource, FromEbml}; +use crate::ebml::FromEbml; use crate::error::WebmetroError; pub struct EbmlStreamingParser { @@ -76,16 +76,6 @@ impl> EbmlStreamingParser } } -impl> EbmlEventSource - for EbmlStreamingParser -{ - type Error = WebmetroError; - - fn poll_event<'a, T: FromEbml<'a>>(&'a mut self) -> Result>, WebmetroError> { - return EbmlStreamingParser::poll_event(self); - } -} - #[cfg(test)] mod tests { use bytes::IntoBuf; From bc8e45936bd1976e35fec75e055c19fdb04b67c9 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 03:18:51 -0400 Subject: [PATCH 17/29] Convert parser & chunker APIs to work with Futures 0.3-style streams --- src/chunk.rs | 50 ++++++++++-------- src/commands/dump.rs | 24 +++++---- src/commands/filter.rs | 21 ++++---- src/commands/mod.rs | 27 +++++----- src/commands/relay.rs | 7 +-- src/commands/send.rs | 14 ++--- src/stream_parser.rs | 114 +++++++++++++++++++++++------------------ 7 files changed, 139 insertions(+), 118 deletions(-) diff --git a/src/chunk.rs b/src/chunk.rs index 2813ce3..bbd5df4 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -1,8 +1,11 @@ use bytes::{Buf, Bytes}; -use futures::{Async, Stream}; +use futures::{Async}; +use futures3::prelude::*; use std::{ io::Cursor, - mem + mem, + pin::Pin, + task::{Context, Poll, Poll::*}, }; use crate::stream_parser::EbmlStreamingParser; use crate::error::WebmetroError; @@ -128,22 +131,22 @@ fn encode(element: WebmElement, buffer: &mut Cursor>, limit: Option> Stream for WebmChunker +impl> + Unpin> Stream for WebmChunker { - type Item = Chunk; - type Error = WebmetroError; + type Item = Result; - fn poll(&mut self) -> Result>, WebmetroError> { + fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll>> { + let mut chunker = self.get_mut(); loop { let mut return_value = None; let mut new_state = None; - match self.state { + match chunker.state { ChunkerState::BuildingHeader(ref mut buffer) => { - match self.source.poll_event() { - Err(passthru) => return Err(passthru.into()), - Ok(Async::NotReady) => return Ok(Async::NotReady), - Ok(Async::Ready(None)) => return Ok(Async::Ready(None)), + match chunker.source.poll_event(cx) { + Err(passthru) => return Ready(Some(Err(passthru))), + Ok(Async::NotReady) => return Pending, + Ok(Async::Ready(None)) => return Ready(None), Ok(Async::Ready(Some(WebmElement::Cluster))) => { let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); let header_chunk = Chunk::Headers {bytes: Bytes::from(liberated_buffer.into_inner())}; @@ -158,7 +161,7 @@ impl> Stream for WebmChunker< Ok(Async::Ready(Some(WebmElement::Void))) => {}, Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {}, Ok(Async::Ready(Some(element))) => { - encode(element, buffer, self.buffer_size_limit).unwrap_or_else(|err| { + encode(element, buffer, chunker.buffer_size_limit).unwrap_or_else(|err| { return_value = Some(Err(err)); new_state = Some(ChunkerState::End); }); @@ -166,16 +169,16 @@ impl> Stream for WebmChunker< } }, ChunkerState::BuildingCluster(ref mut cluster_head, ref mut buffer) => { - match self.source.poll_event() { - Err(passthru) => return Err(passthru.into()), - Ok(Async::NotReady) => return Ok(Async::NotReady), + match chunker.source.poll_event(cx) { + Err(passthru) => return Ready(Some(Err(passthru))), + Ok(Async::NotReady) => return Pending, Ok(Async::Ready(Some(element @ WebmElement::EbmlHead))) | Ok(Async::Ready(Some(element @ WebmElement::Segment))) => { let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); let mut new_header_cursor = Cursor::new(Vec::new()); - match encode(element, &mut new_header_cursor, self.buffer_size_limit) { + match encode(element, &mut new_header_cursor, chunker.buffer_size_limit) { Ok(_) => { return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterHead(liberated_cluster_head))))); new_state = Some(ChunkerState::EmittingClusterBodyBeforeNewHeader{ @@ -205,7 +208,7 @@ impl> Stream for WebmChunker< cluster_head.keyframe = true; } cluster_head.observe_simpleblock_timecode(block.timecode); - encode(WebmElement::SimpleBlock(*block), buffer, self.buffer_size_limit).unwrap_or_else(|err| { + encode(WebmElement::SimpleBlock(*block), buffer, chunker.buffer_size_limit).unwrap_or_else(|err| { return_value = Some(Err(err)); new_state = Some(ChunkerState::End); }); @@ -214,7 +217,7 @@ impl> Stream for WebmChunker< Ok(Async::Ready(Some(WebmElement::Void))) => {}, Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {}, Ok(Async::Ready(Some(element))) => { - encode(element, buffer, self.buffer_size_limit).unwrap_or_else(|err| { + encode(element, buffer, chunker.buffer_size_limit).unwrap_or_else(|err| { return_value = Some(Err(err)); new_state = Some(ChunkerState::End); }); @@ -252,14 +255,19 @@ impl> Stream for WebmChunker< return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterBody {bytes: Bytes::from(liberated_buffer)})))); new_state = Some(ChunkerState::End); }, - ChunkerState::End => return Ok(Async::Ready(None)) + ChunkerState::End => return Ready(None) }; if let Some(new_state) = new_state { - self.state = new_state; + chunker.state = new_state; } if let Some(return_value) = return_value { - return return_value; + return match return_value { + Ok(Async::Ready(Some(chunk))) => Ready(Some(Ok(chunk))), + Ok(Async::Ready(None)) => Ready(None), + Ok(Async::NotReady) => Pending, + Err(err) => Ready(Some(Err(err))), + }; } } } diff --git a/src/commands/dump.rs b/src/commands/dump.rs index 8b691e6..55b8d69 100644 --- a/src/commands/dump.rs +++ b/src/commands/dump.rs @@ -1,5 +1,7 @@ use clap::{App, AppSettings, ArgMatches, SubCommand}; -use futures::prelude::*; +use futures::Async; +use futures3::future::{FutureExt, poll_fn}; +use std::task::Poll; use super::stdin_stream; use webmetro::{ @@ -21,15 +23,17 @@ pub fn run(_args: &ArgMatches) -> Result<(), WebmetroError> { let mut events = stdin_stream().parse_ebml(); - // stdin is sync so Async::NotReady will never happen - while let Ok(Async::Ready(Some(element))) = events.poll_event() { - match element { - // suppress printing byte arrays - Tracks(slice) => println!("Tracks[{}]", slice.len()), - SimpleBlock(SimpleBlock {timecode, ..}) => println!("SimpleBlock@{}", timecode), - other => println!("{:?}", other) + Ok(poll_fn(|cx| { + // stdin is sync so Async::NotReady will never happen on this tokio version + while let Ok(Async::Ready(Some(element))) = events.poll_event(cx) { + match element { + // suppress printing byte arrays + Tracks(slice) => println!("Tracks[{}]", slice.len()), + SimpleBlock(SimpleBlock {timecode, ..}) => println!("SimpleBlock@{}", timecode), + other => println!("{:?}", other) + } } - } - Ok(()) + Poll::Ready(()) + }).now_or_never().expect("Stdin should never go async")) } diff --git a/src/commands/filter.rs b/src/commands/filter.rs index c5d907d..40c271f 100644 --- a/src/commands/filter.rs +++ b/src/commands/filter.rs @@ -4,12 +4,9 @@ use std::{ }; use clap::{App, Arg, ArgMatches, SubCommand}; -use futures::prelude::*; -use futures3::compat::{ - Compat, - Compat01As03 -}; -use tokio::runtime::Runtime; +use futures3::prelude::*; +use futures3::future::ready; +use tokio2::runtime::Runtime; use super::stdin_stream; use webmetro::{ @@ -19,8 +16,8 @@ use webmetro::{ }, error::WebmetroError, fixers::{ - ChunkStream, ChunkTimecodeFixer, + Throttle, }, stream_parser::StreamEbml }; @@ -35,18 +32,18 @@ pub fn options() -> App<'static, 'static> { pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { let mut timecode_fixer = ChunkTimecodeFixer::new(); - let mut chunk_stream: Box + Send> = Box::new( + let mut chunk_stream: Box, Ok = Chunk, Error = WebmetroError> + Send + Unpin> = Box::new( stdin_stream() .parse_ebml() .chunk_webm() - .map(move |chunk| timecode_fixer.process(chunk)) + .map_ok(move |chunk| timecode_fixer.process(chunk)) ); if args.is_present("throttle") { - chunk_stream = Box::new(Compat::new(Compat01As03::new(chunk_stream).throttle())); + chunk_stream = Box::new(Throttle::new(chunk_stream)); } - Runtime::new().unwrap().block_on(chunk_stream.for_each(|chunk| { - io::stdout().write_all(chunk.as_ref()).map_err(WebmetroError::from) + Runtime::new().unwrap().block_on(chunk_stream.try_for_each(|chunk| { + ready(io::stdout().write_all(chunk.as_ref()).map_err(WebmetroError::from)) })) } diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 3acf871..f59349e 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,15 +1,7 @@ -use std::io::stdin; +use std::io::Cursor; -use bytes::{ - Buf, - IntoBuf -}; -use futures::prelude::*; -use tokio_io::io::AllowStdIo; -use tokio_codec::{ - BytesCodec, - FramedRead -}; +use bytes::Bytes; +use futures3::TryStreamExt; use webmetro::error::WebmetroError; pub mod dump; @@ -20,8 +12,13 @@ pub mod send; /// An adapter that makes chunks of bytes from stdin available as a Stream; /// is NOT actually async, and just uses blocking read. Don't use more than /// one at once, who knows who gets which bytes. -pub fn stdin_stream() -> impl Stream { - FramedRead::new(AllowStdIo::new(stdin()), BytesCodec::new()) - .map(|bytes| bytes.into_buf()) - .map_err(WebmetroError::from) +pub fn stdin_stream() -> impl futures3::TryStream< + Item = Result, WebmetroError>, + Ok = Cursor, + Error = WebmetroError, +> + Sized + + Unpin { + tokio2::codec::FramedRead::new(tokio2::io::stdin(), tokio2::codec::BytesCodec::new()) + .map_ok(|bytes| Cursor::new(bytes.freeze())) + .map_err(WebmetroError::from) } diff --git a/src/commands/relay.rs b/src/commands/relay.rs index ae4820c..fd1c4bc 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -17,6 +17,7 @@ use futures3::{ compat::{ Compat, CompatSink, + Compat01As03, }, Never, prelude::*, @@ -66,13 +67,13 @@ fn get_stream(channel: Handle) -> impl Stream) -> impl Stream { - let source = stream - .map_err(WebmetroError::from) + let source = Compat01As03::new(stream + .map_err(WebmetroError::from)) .parse_ebml().with_soft_limit(BUFFER_LIMIT) .chunk_webm().with_soft_limit(BUFFER_LIMIT); let sink = CompatSink::new(Transmitter::new(channel)); - source.forward(sink.sink_map_err(|err| -> WebmetroError {match err {}})) + Compat::new(source).forward(sink.sink_map_err(|err| -> WebmetroError {match err {}})) .into_stream() .map(|_| empty()) .map_err(|err| { diff --git a/src/commands/send.rs b/src/commands/send.rs index 4bf9fa3..eb02d7a 100644 --- a/src/commands/send.rs +++ b/src/commands/send.rs @@ -2,9 +2,9 @@ use clap::{App, Arg, ArgMatches, SubCommand}; use futures::{ prelude::* }; +use futures3::prelude::*; use futures3::compat::{ Compat, - Compat01As03 }; use hyper::{ Body, @@ -24,8 +24,8 @@ use webmetro::{ }, error::WebmetroError, fixers::{ - ChunkStream, ChunkTimecodeFixer, + Throttle, }, stream_parser::StreamEbml }; @@ -41,7 +41,7 @@ pub fn options() -> App<'static, 'static> { .help("Slow down upload to \"real time\" speed as determined by the timestamps (useful for streaming static files)")) } -type BoxedChunkStream = Box + Send>; +type BoxedChunkStream = Box, Ok = Chunk, Error = WebmetroError> + Send + Unpin>; pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { let mut timecode_fixer = ChunkTimecodeFixer::new(); @@ -49,7 +49,7 @@ pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { stdin_stream() .parse_ebml() .chunk_webm() - .map(move |chunk| timecode_fixer.process(chunk)) + .map_ok(move |chunk| timecode_fixer.process(chunk)) ); let url_str = match args.value_of("url") { @@ -58,15 +58,15 @@ pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { }; if args.is_present("throttle") { - chunk_stream = Box::new(Compat::new(Compat01As03::new(chunk_stream).throttle())); + chunk_stream = Box::new(Throttle::new(chunk_stream)); } - let request_payload = Body::wrap_stream(chunk_stream.map( + let request_payload = Body::wrap_stream(Compat::new(chunk_stream.map_ok( |webm_chunk| webm_chunk.into_bytes() ).map_err(|err| { eprintln!("{}", &err); err - })); + }))); let request = Request::put(url_str) diff --git a/src/stream_parser.rs b/src/stream_parser.rs index b0bfe20..ed4a0a4 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -1,5 +1,7 @@ use bytes::{Buf, BufMut, Bytes, BytesMut}; -use futures::{stream::Stream, Async}; +use futures::Async; +use futures3::stream::{Stream, StreamExt, TryStream}; +use std::task::{Context, Poll}; use crate::ebml::FromEbml; use crate::error::WebmetroError; @@ -21,10 +23,10 @@ impl EbmlStreamingParser { } } -pub trait StreamEbml +pub trait StreamEbml: Sized + TryStream + Unpin where - Self: Sized + Stream, - Self::Item: Buf, + Self: Sized + TryStream + Unpin, + Self::Ok: Buf, { fn parse_ebml(self) -> EbmlStreamingParser { EbmlStreamingParser { @@ -36,11 +38,12 @@ where } } -impl> StreamEbml for S {} +impl> + Unpin> StreamEbml for S {} -impl> EbmlStreamingParser { +impl> + Unpin> EbmlStreamingParser { pub fn poll_event<'a, T: FromEbml<'a>>( &'a mut self, + cx: &mut Context, ) -> Result>, WebmetroError> { loop { match T::check_space(&self.buffer)? { @@ -64,13 +67,14 @@ impl> EbmlStreamingParser } } - match self.stream.poll()? { - Async::Ready(Some(buf)) => { + match self.stream.poll_next_unpin(cx)? { + Poll::Ready(Some(buf)) => { self.buffer.reserve(buf.remaining()); self.buffer.put(buf); // ok can retry decoding now } - other => return Ok(other.map(|_| None)), + Poll::Ready(None) => return Ok(Async::Ready(None)), + Poll::Pending => return Ok(Async::NotReady), } } } @@ -79,8 +83,12 @@ impl> EbmlStreamingParser #[cfg(test)] mod tests { use bytes::IntoBuf; - use futures::prelude::*; use futures::Async::*; + use futures3::{ + future::poll_fn, + stream::StreamExt, + FutureExt, + }; use matches::assert_matches; use crate::stream_parser::*; @@ -89,47 +97,53 @@ mod tests { #[test] fn stream_webm_test() { - let pieces = vec![ - &ENCODE_WEBM_TEST_FILE[0..20], - &ENCODE_WEBM_TEST_FILE[20..40], - &ENCODE_WEBM_TEST_FILE[40..], - ]; + poll_fn(|cx| { + let pieces = vec![ + &ENCODE_WEBM_TEST_FILE[0..20], + &ENCODE_WEBM_TEST_FILE[20..40], + &ENCODE_WEBM_TEST_FILE[40..], + ]; - let mut stream_parser = futures::stream::iter_ok(pieces.iter()) - .map(|bytes| bytes.into_buf()) - .parse_ebml(); + let mut stream_parser = futures3::stream::iter(pieces.iter()) + .map(|bytes| Ok(bytes.into_buf())) + .parse_ebml(); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::EbmlHead))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::Segment))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::Tracks(_)))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::Cluster))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::Timecode(0)))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::SimpleBlock(_)))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::Cluster))) - ); - assert_matches!( - stream_parser.poll_event(), - Ok(Ready(Some(WebmElement::Timecode(1000)))) - ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::EbmlHead))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::Segment))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::Tracks(_)))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::Cluster))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::Timecode(0)))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::SimpleBlock(_)))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::Cluster))) + ); + assert_matches!( + stream_parser.poll_event(cx), + Ok(Ready(Some(WebmElement::Timecode(1000)))) + ); + + std::task::Poll::Ready(()) + }) + .now_or_never() + .expect("Test succeeded without blocking"); } } From d9e9b9e49cb1c949cbf5f5a9774eef4f7011b73f Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 04:03:52 -0400 Subject: [PATCH 18/29] Give stream_parser an async next() method, making async_parser no longer interesting. --- src/async_parser.rs | 108 ------------------------------------------- src/stream_parser.rs | 68 ++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 114 deletions(-) delete mode 100644 src/async_parser.rs diff --git a/src/async_parser.rs b/src/async_parser.rs deleted file mode 100644 index e650ddb..0000000 --- a/src/async_parser.rs +++ /dev/null @@ -1,108 +0,0 @@ -use bytes::{Bytes, BytesMut}; -use std::future::Future; - -use crate::ebml::FromEbml; -use crate::error::WebmetroError; - -#[derive(Default)] -pub struct EbmlParser { - buffer: BytesMut, - buffer_size_limit: Option, - borrowed: Bytes -} - -impl EbmlParser { - /// add a "soft" buffer size limit; if the input buffer exceeds this size, - /// error the stream instead of resuming. It's still possible for the buffer - /// to exceed this size *after* a fill, so ensure input sizes are reasonable. - pub fn with_soft_limit(mut self, limit: usize) -> Self { - self.buffer_size_limit = Some(limit); - self - } - - pub fn feed(&mut self, bytes: impl AsRef<[u8]>) { - self.buffer.extend_from_slice(bytes.as_ref()) - } - - pub fn next_element<'a, T: FromEbml<'a>>(&'a mut self) -> Result, WebmetroError> { - Ok(match T::check_space(&self.buffer)? { - None => None, - Some(info) => { - let mut bytes = self.buffer.split_to(info.element_len).freeze(); - bytes.advance(info.body_offset); - self.borrowed = bytes; - Some(T::decode(info.element_id, &self.borrowed)?) - } - }) - } - - pub async fn next_element_with_feeder< - 'a, - T: FromEbml<'a>, - F: FnMut() -> Fut, - Fut: Future>, - >( - &'a mut self, - mut feeder: F, - ) -> Result, WebmetroError> { - loop { - if let Some(_) = T::check_space(&self.buffer)? { - return self.next_element(); - } - - if let Some(limit) = self.buffer_size_limit { - if limit <= self.buffer.len() { - // hit our buffer limit and still nothing parsed - return Err(WebmetroError::ResourcesExceeded); - } - } - - self.buffer.extend(feeder().await?); - } - } -} - -#[cfg(test)] -mod tests { - use matches::assert_matches; - - use crate::async_parser::*; - use crate::tests::ENCODE_WEBM_TEST_FILE; - use crate::webm::*; - - #[test] - fn async_webm_test() { - let pieces = vec![ - &ENCODE_WEBM_TEST_FILE[0..20], - &ENCODE_WEBM_TEST_FILE[20..40], - &ENCODE_WEBM_TEST_FILE[40..], - ]; - - let mut piece_iter = pieces.iter(); - - let result: Result<_, WebmetroError> = futures3::executor::block_on(async { - let mut next = || { - let result = if let Some(bytes) = piece_iter.next() { - Ok(Bytes::from(*bytes)) - } else { - Err("End of input".into()) - }; - async { result } - }; - - let mut parser = EbmlParser::default(); - - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::EbmlHead)); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Segment)); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Tracks(_))); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Cluster)); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Timecode(0))); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::SimpleBlock(_))); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Cluster)); - assert_matches!(parser.next_element_with_feeder(&mut next).await?, Some(WebmElement::Timecode(1000))); - - Ok(()) - }); - result.unwrap(); - } -} diff --git a/src/stream_parser.rs b/src/stream_parser.rs index ed4a0a4..b9313ac 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -80,15 +80,42 @@ impl> + Unpin> EbmlStreamingPa } } +impl> + Unpin> EbmlStreamingParser { + pub async fn next<'a, T: FromEbml<'a>>(&'a mut self) -> Result, WebmetroError> { + loop { + if let Some(info) = T::check_space(&self.buffer)? { + let mut bytes = self.buffer.split_to(info.element_len).freeze(); + bytes.advance(info.body_offset); + self.borrowed = bytes; + return Ok(Some(T::decode(info.element_id, &self.borrowed)?)); + } + + if let Some(limit) = self.buffer_size_limit { + if limit <= self.buffer.len() { + // hit our buffer limit and still nothing parsed + return Err(WebmetroError::ResourcesExceeded); + } + } + + match self.stream.next().await.transpose()? { + Some(refill) => { + self.buffer.reserve(refill.remaining()); + self.buffer.put(refill); + } + None => { + // Nothing left, we're done + return Ok(None); + } + } + } + } +} + #[cfg(test)] mod tests { use bytes::IntoBuf; use futures::Async::*; - use futures3::{ - future::poll_fn, - stream::StreamExt, - FutureExt, - }; + use futures3::{future::poll_fn, stream::StreamExt, FutureExt}; use matches::assert_matches; use crate::stream_parser::*; @@ -144,6 +171,35 @@ mod tests { std::task::Poll::Ready(()) }) .now_or_never() - .expect("Test succeeded without blocking"); + .expect("Test tried to block on I/O"); + } + + #[test] + fn async_webm_test() { + let pieces = vec![ + &ENCODE_WEBM_TEST_FILE[0..20], + &ENCODE_WEBM_TEST_FILE[20..40], + &ENCODE_WEBM_TEST_FILE[40..], + ]; + + async { + let mut parser = futures3::stream::iter(pieces.iter()) + .map(|bytes| Ok(bytes.into_buf())) + .parse_ebml(); + + assert_matches!(parser.next().await?, Some(WebmElement::EbmlHead)); + assert_matches!(parser.next().await?, Some(WebmElement::Segment)); + assert_matches!(parser.next().await?, Some(WebmElement::Tracks(_))); + assert_matches!(parser.next().await?, Some(WebmElement::Cluster)); + assert_matches!(parser.next().await?, Some(WebmElement::Timecode(0))); + assert_matches!(parser.next().await?, Some(WebmElement::SimpleBlock(_))); + assert_matches!(parser.next().await?, Some(WebmElement::Cluster)); + assert_matches!(parser.next().await?, Some(WebmElement::Timecode(1000))); + + Result::<(), WebmetroError>::Ok(()) + } + .now_or_never() + .expect("Test tried to block on I/O") + .expect("Parse failed"); } } From ee818dbfd872297b9afdd383506f84f5c745cee5 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 04:04:11 -0400 Subject: [PATCH 19/29] Run dump command on a runtime so it works properly. --- src/commands/dump.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/commands/dump.rs b/src/commands/dump.rs index 55b8d69..2ceaa42 100644 --- a/src/commands/dump.rs +++ b/src/commands/dump.rs @@ -1,7 +1,5 @@ use clap::{App, AppSettings, ArgMatches, SubCommand}; -use futures::Async; -use futures3::future::{FutureExt, poll_fn}; -use std::task::Poll; +use tokio2::runtime::Runtime; use super::stdin_stream; use webmetro::{ @@ -23,9 +21,8 @@ pub fn run(_args: &ArgMatches) -> Result<(), WebmetroError> { let mut events = stdin_stream().parse_ebml(); - Ok(poll_fn(|cx| { - // stdin is sync so Async::NotReady will never happen on this tokio version - while let Ok(Async::Ready(Some(element))) = events.poll_event(cx) { + Runtime::new().unwrap().block_on(async { + while let Some(element) = events.next().await? { match element { // suppress printing byte arrays Tracks(slice) => println!("Tracks[{}]", slice.len()), @@ -33,7 +30,6 @@ pub fn run(_args: &ArgMatches) -> Result<(), WebmetroError> { other => println!("{:?}", other) } } - - Poll::Ready(()) - }).now_or_never().expect("Stdin should never go async")) + Ok(()) + }) } From 8de9ffdb218d642546125dc7219e820a83eeb419 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 15:08:45 -0400 Subject: [PATCH 20/29] fixup async parser deletion --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 84a89d0..39a899d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,6 @@ pub mod ebml; pub mod error; -pub mod async_parser; pub mod iterator; pub mod stream_parser; From 32c72e1ee848acec0f3666c99857abae372bc0a2 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Wed, 16 Oct 2019 00:15:44 -0400 Subject: [PATCH 21/29] Port send subcommand to core futures & alpha hyper (fixes --throttle) --- Cargo.lock | 89 ++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/commands/send.rs | 83 +++++++++++++++++------------------------ src/error.rs | 1 + 4 files changed, 125 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 20eb6ee..8479993 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -337,6 +337,26 @@ dependencies = [ "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "h2" +version = "0.2.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-sink-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "headers" version = "0.2.3" @@ -382,6 +402,15 @@ dependencies = [ "tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http-body" +version = "0.2.0-alpha.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "httparse" version = "1.3.4" @@ -416,6 +445,36 @@ dependencies = [ "want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "hyper" +version = "0.13.0-alpha.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-channel-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-core-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "futures-util-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.2.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "http-body 0.2.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "pin-project 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-net 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.3.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-make 0.3.0-alpha.2a (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.3.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", + "want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "idna" version = "0.2.0" @@ -1436,6 +1495,20 @@ dependencies = [ "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tower-make" +version = "0.3.0-alpha.2a" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "tokio-io 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.3.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tower-service" +version = "0.3.0-alpha.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "tracing" version = "0.1.9" @@ -1589,6 +1662,15 @@ dependencies = [ "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "warp" version = "0.1.20" @@ -1635,6 +1717,7 @@ dependencies = [ "futures-preview 0.3.0-alpha.19 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.13.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1726,12 +1809,15 @@ dependencies = [ "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" "checksum getrandom 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "473a1265acc8ff1e808cd0a1af8cee3c2ee5200916058a2ca113c29f2d903571" "checksum h2 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" +"checksum h2 0.2.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0f107db1419ef8271686187b1a5d47c6431af4a7f4d98b495e7b7fc249bb0a78" "checksum headers 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "882ca7d8722f33ce2c2db44f95425d6267ed59ca96ce02acbe58320054ceb642" "checksum headers-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "967131279aaa9f7c20c7205b45a391638a83ab118e6509b2d0ccbe08de044237" "checksum http 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "372bcb56f939e449117fb0869c2e8fd8753a8223d92a172c6e808cf123a5b6e4" "checksum http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" +"checksum http-body 0.2.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1f3aef6f3de2bd8585f5b366f3f550b5774500b4764d00cf00f903c95749eec3" "checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" "checksum hyper 0.12.35 (registry+https://github.com/rust-lang/crates.io-index)" = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" +"checksum hyper 0.13.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)" = "2d05aa523087ac0b9d8b93dd80d5d482a697308ed3b0dca7b0667511a7fa7cdc" "checksum idna 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" "checksum indexmap 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a61202fbe46c4a951e9404a720a0180bcf3212c750d735cb5c4ba4dc551299f3" "checksum input_buffer 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e1b822cc844905551931d6f81608ed5f50a79c1078a4e2b4d42dbc7c1eedfbf" @@ -1842,6 +1928,8 @@ dependencies = [ "checksum tokio-timer 0.3.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b97c1587fe71018eb245a4a9daa13a5a3b681bbc1f7fdadfe24720e141472c13" "checksum tokio-udp 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f02298505547f73e60f568359ef0d016d5acd6e830ab9bc7c4a5b3403440121b" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum tower-make 0.3.0-alpha.2a (registry+https://github.com/rust-lang/crates.io-index)" = "316d47dd40cde4ac5d88110eaf9a10a4e2a68612d9c056cd2aa24e37dcb484cd" +"checksum tower-service 0.3.0-alpha.2 (registry+https://github.com/rust-lang/crates.io-index)" = "63ff37396cd966ce43bea418bfa339f802857495f797dafa00bea5b7221ebdfa" "checksum tracing 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c21ff9457accc293386c20e8f754d0b059e67e325edf2284f04230d125d7e5ff" "checksum tracing-attributes 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3ff978fd9c9afe2cc9c671e247713421c6406b3422305cbdce5de695d3ab4c3c" "checksum tracing-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "528c8ebaaa16cdac34795180b046c031775b0d56402704d98c096788f33d646a" @@ -1862,6 +1950,7 @@ dependencies = [ "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum want 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" +"checksum want 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" "checksum warp 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3921463c44f680d24f1273ea55efd985f31206a22a02dee207a2ec72684285ca" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" "checksum weak-table 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a5862bb244c852a56c6f3c39668ff181271bda44513ef30d2073a3eedd9898d" diff --git a/Cargo.toml b/Cargo.toml index 28195e5..8132c9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ futures = "0.1.29" futures3 = { package = "futures-preview", version="0.3.0-alpha", features = ["compat"] } http = "0.1.18" hyper = "0.12.35" +hyper13 = { package = "hyper", version="0.13.0-alpha.4", features = ["unstable-stream"] } matches = "0.1.8" odds = { version = "0.3.1", features = ["std-vec"] } tokio = "0.1.22" diff --git a/src/commands/send.rs b/src/commands/send.rs index eb02d7a..e06b03c 100644 --- a/src/commands/send.rs +++ b/src/commands/send.rs @@ -1,33 +1,15 @@ use clap::{App, Arg, ArgMatches, SubCommand}; -use futures::{ - prelude::* -}; use futures3::prelude::*; -use futures3::compat::{ - Compat, -}; -use hyper::{ - Body, - Client, - client::HttpConnector, - Request -}; -use tokio::runtime::Runtime; +use hyper13::{client::HttpConnector, Body, Client, Request}; +use std::io::{stdout, Write}; +use tokio2::runtime::Runtime; -use super::{ - stdin_stream -}; +use super::stdin_stream; use webmetro::{ - chunk::{ - Chunk, - WebmStream - }, + chunk::{Chunk, WebmStream}, error::WebmetroError, - fixers::{ - ChunkTimecodeFixer, - Throttle, - }, - stream_parser::StreamEbml + fixers::{ChunkTimecodeFixer, Throttle}, + stream_parser::StreamEbml, }; pub fn options() -> App<'static, 'static> { @@ -41,46 +23,49 @@ pub fn options() -> App<'static, 'static> { .help("Slow down upload to \"real time\" speed as determined by the timestamps (useful for streaming static files)")) } -type BoxedChunkStream = Box, Ok = Chunk, Error = WebmetroError> + Send + Unpin>; +type BoxedChunkStream = Box< + dyn TryStream, Ok = Chunk, Error = WebmetroError> + + Send + + Sync + + Unpin, +>; pub fn run(args: &ArgMatches) -> Result<(), WebmetroError> { let mut timecode_fixer = ChunkTimecodeFixer::new(); let mut chunk_stream: BoxedChunkStream = Box::new( stdin_stream() - .parse_ebml() - .chunk_webm() - .map_ok(move |chunk| timecode_fixer.process(chunk)) + .parse_ebml() + .chunk_webm() + .map_ok(move |chunk| timecode_fixer.process(chunk)), ); let url_str = match args.value_of("url") { Some(url) => String::from(url), - _ => return Err("Listen address wasn't provided".into()) + _ => return Err("Listen address wasn't provided".into()), }; if args.is_present("throttle") { chunk_stream = Box::new(Throttle::new(chunk_stream)); } - let request_payload = Body::wrap_stream(Compat::new(chunk_stream.map_ok( - |webm_chunk| webm_chunk.into_bytes() - ).map_err(|err| { - eprintln!("{}", &err); - err - }))); + let chunk_stream = chunk_stream + .map_ok(|webm_chunk| webm_chunk.into_bytes()) + .map_err(|err| { + eprintln!("{}", &err); + err + }); - - let request = Request::put(url_str) - .body(request_payload) - .map_err(WebmetroError::from)?; + let request_payload = Body::wrap_stream(chunk_stream); - let client = Client::builder().build(HttpConnector::new(1)); - let future = client.request(request) - .and_then(|response| { - response.into_body().for_each(|_chunk| { - Ok(()) - }) + let request = Request::put(url_str).body(request_payload)?; + let client = Client::builder().build(HttpConnector::new()); + + Runtime::new().unwrap().block_on(async { + let response = client.request(request).await?; + let mut response_stream = response.into_body(); + while let Some(response_chunk) = response_stream.next().await.transpose()? { + stdout().write_all(&response_chunk)?; + } + Ok(()) }) - .map_err(WebmetroError::from); - - Runtime::new().unwrap().block_on(future) } diff --git a/src/error.rs b/src/error.rs index 2e40750..b54bc5a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,6 +6,7 @@ custom_error!{pub WebmetroError EbmlError{source: crate::ebml::EbmlError} = "EBML error: {source}", HttpError{source: http::Error} = "HTTP error: {source}", HyperError{source: hyper::Error} = "Hyper error: {source}", + Hyper13Error{source: hyper13::Error} = "Hyper error: {source}", IoError{source: std::io::Error} = "IO error: {source}", TimerError{source: tokio::timer::Error} = "Timer error: {source}", WarpError{source: warp::Error} = "Warp error: {source}", From a5baa39014f87d65026f823658c9a39a13a22ec9 Mon Sep 17 00:00:00 2001 From: Tangent 128 Date: Mon, 21 Oct 2019 17:11:09 -0400 Subject: [PATCH 22/29] Fix server kicking clients off when a source left --- src/channel.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 9e901de..deb921b 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -91,16 +91,9 @@ impl Sink for Transmitter { } fn poll_close(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { - let mut channel = self.channel.lock().expect("Locking channel"); - - // there's no useful error we can offer here, just give everything a chance to try closing - channel.listeners.retain_mut(|listener| Pin::new(listener).poll_close(cx).is_pending()); - - return if channel.listeners.len() > 0 { - Poll::Pending - } else { - Poll::Ready(Ok(())) - } + // don't actually disconnect listeners, since other sources may want to transmit to this channel; + // just ensure we've sent everything we can out + self.poll_flush(cx) } } From 58ca126a02419024b4f9cad1b89cccf6f646fb88 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 16 Nov 2019 13:17:37 -0500 Subject: [PATCH 23/29] remove rust-toolchain now that async/await's stable --- rust-toolchain | 1 - 1 file changed, 1 deletion(-) delete mode 100644 rust-toolchain diff --git a/rust-toolchain b/rust-toolchain deleted file mode 100644 index bf867e0..0000000 --- a/rust-toolchain +++ /dev/null @@ -1 +0,0 @@ -nightly From 4abd26ddbfd9d11c0488f2d1c7b5bce914fe59d7 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 16 Nov 2019 13:17:44 -0500 Subject: [PATCH 24/29] cleanup --- src/commands/relay.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/commands/relay.rs b/src/commands/relay.rs index fd1c4bc..0355f12 100644 --- a/src/commands/relay.rs +++ b/src/commands/relay.rs @@ -21,7 +21,6 @@ use futures3::{ }, Never, prelude::*, - StreamExt }; use hyper::{ Body, From 7e85a8750b8f5e18720890c6c82f8540ab390f0b Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 16 Nov 2019 13:27:58 -0500 Subject: [PATCH 25/29] Removed old Tokio version from Cargo.toml --- Cargo.lock | 3 --- Cargo.toml | 3 --- src/error.rs | 1 - 3 files changed, 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8479993..e295a7d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1720,10 +1720,7 @@ dependencies = [ "hyper 0.13.0-alpha.4 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "odds 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.2.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "warp 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "weak-table 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/Cargo.toml b/Cargo.toml index 8132c9e..5d965d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,9 +15,6 @@ hyper = "0.12.35" hyper13 = { package = "hyper", version="0.13.0-alpha.4", features = ["unstable-stream"] } matches = "0.1.8" odds = { version = "0.3.1", features = ["std-vec"] } -tokio = "0.1.22" tokio2 = { package = "tokio", version="0.2.0-alpha.6" } -tokio-codec = "0.1.1" -tokio-io = "0.1.12" warp = "0.1.20" weak-table = "0.2.3" diff --git a/src/error.rs b/src/error.rs index b54bc5a..5c5d297 100644 --- a/src/error.rs +++ b/src/error.rs @@ -8,7 +8,6 @@ custom_error!{pub WebmetroError HyperError{source: hyper::Error} = "Hyper error: {source}", Hyper13Error{source: hyper13::Error} = "Hyper error: {source}", IoError{source: std::io::Error} = "IO error: {source}", - TimerError{source: tokio::timer::Error} = "Timer error: {source}", WarpError{source: warp::Error} = "Warp error: {source}", ApplicationError{message: String} = "{message}" } From 7485119028d079e11eabca66b2d88398277ed4e3 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 16 Nov 2019 14:22:53 -0500 Subject: [PATCH 26/29] remove an unneeded test --- src/lib.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 39a899d..c629cfd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -15,18 +15,6 @@ pub use crate::ebml::{EbmlError, FromEbml}; #[cfg(test)] mod tests { - use futures::future::{ok, Future}; - pub const TEST_FILE: &'static [u8] = include_bytes!("data/test1.webm"); pub const ENCODE_WEBM_TEST_FILE: &'static [u8] = include_bytes!("data/encode_webm_test.webm"); - - #[test] - fn hello_futures() { - let my_future = ok::("Hello".into()) - .map(|hello| hello + ", Futures!"); - - let string_result = my_future.wait().unwrap(); - - assert_eq!(string_result, "Hello, Futures!"); - } } From d3b147f8ea3547c038289b6c9723db4cd9e02f95 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 16 Nov 2019 15:19:14 -0500 Subject: [PATCH 27/29] Take advantage of NLL to be able to state-transition & return directly in chunker --- src/chunk.rs | 77 +++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/src/chunk.rs b/src/chunk.rs index bbd5df4..7775b45 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -138,9 +138,6 @@ impl> + Unpin> Stream for Webm fn poll_next(self: Pin<&mut Self>, cx: &mut Context) -> Poll>> { let mut chunker = self.get_mut(); loop { - let mut return_value = None; - let mut new_state = None; - match chunker.state { ChunkerState::BuildingHeader(ref mut buffer) => { match chunker.source.poll_event(cx) { @@ -151,20 +148,20 @@ impl> + Unpin> Stream for Webm let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); let header_chunk = Chunk::Headers {bytes: Bytes::from(liberated_buffer.into_inner())}; - return_value = Some(Ok(Async::Ready(Some(header_chunk)))); - new_state = Some(ChunkerState::BuildingCluster( + chunker.state = ChunkerState::BuildingCluster( ClusterHead::new(0), Cursor::new(Vec::new()) - )); + ); + return Ready(Some(Ok(header_chunk))); }, Ok(Async::Ready(Some(WebmElement::Info))) => {}, Ok(Async::Ready(Some(WebmElement::Void))) => {}, Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {}, Ok(Async::Ready(Some(element))) => { - encode(element, buffer, chunker.buffer_size_limit).unwrap_or_else(|err| { - return_value = Some(Err(err)); - new_state = Some(ChunkerState::End); - }); + if let Err(err) = encode(element, buffer, chunker.buffer_size_limit) { + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); + } } } }, @@ -180,15 +177,15 @@ impl> + Unpin> Stream for Webm let mut new_header_cursor = Cursor::new(Vec::new()); match encode(element, &mut new_header_cursor, chunker.buffer_size_limit) { Ok(_) => { - return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterHead(liberated_cluster_head))))); - new_state = Some(ChunkerState::EmittingClusterBodyBeforeNewHeader{ + chunker.state = ChunkerState::EmittingClusterBodyBeforeNewHeader{ body: liberated_buffer.into_inner(), new_header: new_header_cursor - }); + }; + return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); }, Err(err) => { - return_value = Some(Err(err)); - new_state = Some(ChunkerState::End); + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); } } } @@ -196,8 +193,8 @@ impl> + Unpin> Stream for Webm let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); - return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterHead(liberated_cluster_head))))); - new_state = Some(ChunkerState::EmittingClusterBody(liberated_buffer.into_inner())); + chunker.state = ChunkerState::EmittingClusterBody(liberated_buffer.into_inner()); + return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); }, Ok(Async::Ready(Some(WebmElement::Timecode(timecode)))) => { cluster_head.update_timecode(timecode); @@ -208,67 +205,55 @@ impl> + Unpin> Stream for Webm cluster_head.keyframe = true; } cluster_head.observe_simpleblock_timecode(block.timecode); - encode(WebmElement::SimpleBlock(*block), buffer, chunker.buffer_size_limit).unwrap_or_else(|err| { - return_value = Some(Err(err)); - new_state = Some(ChunkerState::End); - }); + if let Err(err) = encode(WebmElement::SimpleBlock(*block), buffer, chunker.buffer_size_limit) { + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); + } }, Ok(Async::Ready(Some(WebmElement::Info))) => {}, Ok(Async::Ready(Some(WebmElement::Void))) => {}, Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {}, Ok(Async::Ready(Some(element))) => { - encode(element, buffer, chunker.buffer_size_limit).unwrap_or_else(|err| { - return_value = Some(Err(err)); - new_state = Some(ChunkerState::End); - }); + if let Err(err) = encode(element, buffer, chunker.buffer_size_limit) { + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); + } }, Ok(Async::Ready(None)) => { // flush final Cluster on end of stream let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); - return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterHead(liberated_cluster_head))))); - new_state = Some(ChunkerState::EmittingFinalClusterBody(liberated_buffer.into_inner())); + chunker.state = ChunkerState::EmittingFinalClusterBody(liberated_buffer.into_inner()); + return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); } } }, ChunkerState::EmittingClusterBody(ref mut buffer) => { let liberated_buffer = mem::replace(buffer, Vec::new()); - return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterBody {bytes: Bytes::from(liberated_buffer)})))); - new_state = Some(ChunkerState::BuildingCluster( + chunker.state = ChunkerState::BuildingCluster( ClusterHead::new(0), Cursor::new(Vec::new()) - )); + ); + return Ready(Some(Ok(Chunk::ClusterBody {bytes: Bytes::from(liberated_buffer)}))); }, ChunkerState::EmittingClusterBodyBeforeNewHeader { ref mut body, ref mut new_header } => { let liberated_body = mem::replace(body, Vec::new()); let liberated_header_cursor = mem::replace(new_header, Cursor::new(Vec::new())); - return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterBody {bytes: Bytes::from(liberated_body)})))); - new_state = Some(ChunkerState::BuildingHeader(liberated_header_cursor)); + chunker.state = ChunkerState::BuildingHeader(liberated_header_cursor); + return Ready(Some(Ok(Chunk::ClusterBody {bytes: Bytes::from(liberated_body)}))); }, ChunkerState::EmittingFinalClusterBody(ref mut buffer) => { // flush final Cluster on end of stream let liberated_buffer = mem::replace(buffer, Vec::new()); - return_value = Some(Ok(Async::Ready(Some(Chunk::ClusterBody {bytes: Bytes::from(liberated_buffer)})))); - new_state = Some(ChunkerState::End); + chunker.state = ChunkerState::End; + return Ready(Some(Ok(Chunk::ClusterBody {bytes: Bytes::from(liberated_buffer)}))); }, ChunkerState::End => return Ready(None) }; - - if let Some(new_state) = new_state { - chunker.state = new_state; - } - if let Some(return_value) = return_value { - return match return_value { - Ok(Async::Ready(Some(chunk))) => Ready(Some(Ok(chunk))), - Ok(Async::Ready(None)) => Ready(None), - Ok(Async::NotReady) => Pending, - Err(err) => Ready(Some(Err(err))), - }; - } } } } From e6d8b5849291eba9f272296452bb592d27e75942 Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sat, 16 Nov 2019 15:46:25 -0500 Subject: [PATCH 28/29] prettify the chunker match blocks a bit --- src/chunk.rs | 125 ++++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 61 deletions(-) diff --git a/src/chunk.rs b/src/chunk.rs index 7775b45..60a5066 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -144,23 +144,25 @@ impl> + Unpin> Stream for Webm Err(passthru) => return Ready(Some(Err(passthru))), Ok(Async::NotReady) => return Pending, Ok(Async::Ready(None)) => return Ready(None), - Ok(Async::Ready(Some(WebmElement::Cluster))) => { - let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); - let header_chunk = Chunk::Headers {bytes: Bytes::from(liberated_buffer.into_inner())}; + Ok(Async::Ready(Some(element))) => match element { + WebmElement::Cluster => { + let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); + let header_chunk = Chunk::Headers {bytes: Bytes::from(liberated_buffer.into_inner())}; - chunker.state = ChunkerState::BuildingCluster( - ClusterHead::new(0), - Cursor::new(Vec::new()) - ); - return Ready(Some(Ok(header_chunk))); - }, - Ok(Async::Ready(Some(WebmElement::Info))) => {}, - Ok(Async::Ready(Some(WebmElement::Void))) => {}, - Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {}, - Ok(Async::Ready(Some(element))) => { - if let Err(err) = encode(element, buffer, chunker.buffer_size_limit) { - chunker.state = ChunkerState::End; - return Ready(Some(Err(err))); + chunker.state = ChunkerState::BuildingCluster( + ClusterHead::new(0), + Cursor::new(Vec::new()) + ); + return Ready(Some(Ok(header_chunk))); + }, + WebmElement::Info => {}, + WebmElement::Void => {}, + WebmElement::Unknown(_) => {}, + element => { + if let Err(err) = encode(element, buffer, chunker.buffer_size_limit) { + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); + } } } } @@ -169,55 +171,56 @@ impl> + Unpin> Stream for Webm match chunker.source.poll_event(cx) { Err(passthru) => return Ready(Some(Err(passthru))), Ok(Async::NotReady) => return Pending, - Ok(Async::Ready(Some(element @ WebmElement::EbmlHead))) - | Ok(Async::Ready(Some(element @ WebmElement::Segment))) => { - let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); - let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); + Ok(Async::Ready(Some(element))) => match element { + WebmElement::EbmlHead | WebmElement::Segment => { + let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); + let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); - let mut new_header_cursor = Cursor::new(Vec::new()); - match encode(element, &mut new_header_cursor, chunker.buffer_size_limit) { - Ok(_) => { - chunker.state = ChunkerState::EmittingClusterBodyBeforeNewHeader{ - body: liberated_buffer.into_inner(), - new_header: new_header_cursor - }; - return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); - }, - Err(err) => { + let mut new_header_cursor = Cursor::new(Vec::new()); + match encode(element, &mut new_header_cursor, chunker.buffer_size_limit) { + Ok(_) => { + chunker.state = ChunkerState::EmittingClusterBodyBeforeNewHeader{ + body: liberated_buffer.into_inner(), + new_header: new_header_cursor + }; + return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); + }, + Err(err) => { + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); + } + } + }, + WebmElement::Cluster => { + let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); + let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); + + chunker.state = ChunkerState::EmittingClusterBody(liberated_buffer.into_inner()); + return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); + }, + WebmElement::Timecode(timecode) => { + cluster_head.update_timecode(timecode); + }, + WebmElement::SimpleBlock(ref block) => { + if (block.flags & 0b10000000) != 0 { + // TODO: this is incorrect, condition needs to also affirm we're the first video block of the cluster + cluster_head.keyframe = true; + } + cluster_head.observe_simpleblock_timecode(block.timecode); + if let Err(err) = encode(WebmElement::SimpleBlock(*block), buffer, chunker.buffer_size_limit) { chunker.state = ChunkerState::End; return Ready(Some(Err(err))); } - } - } - Ok(Async::Ready(Some(WebmElement::Cluster))) => { - let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); - let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); - - chunker.state = ChunkerState::EmittingClusterBody(liberated_buffer.into_inner()); - return Ready(Some(Ok(Chunk::ClusterHead(liberated_cluster_head)))); - }, - Ok(Async::Ready(Some(WebmElement::Timecode(timecode)))) => { - cluster_head.update_timecode(timecode); - }, - Ok(Async::Ready(Some(WebmElement::SimpleBlock(ref block)))) => { - if (block.flags & 0b10000000) != 0 { - // TODO: this is incorrect, condition needs to also affirm we're the first video block of the cluster - cluster_head.keyframe = true; - } - cluster_head.observe_simpleblock_timecode(block.timecode); - if let Err(err) = encode(WebmElement::SimpleBlock(*block), buffer, chunker.buffer_size_limit) { - chunker.state = ChunkerState::End; - return Ready(Some(Err(err))); - } - }, - Ok(Async::Ready(Some(WebmElement::Info))) => {}, - Ok(Async::Ready(Some(WebmElement::Void))) => {}, - Ok(Async::Ready(Some(WebmElement::Unknown(_)))) => {}, - Ok(Async::Ready(Some(element))) => { - if let Err(err) = encode(element, buffer, chunker.buffer_size_limit) { - chunker.state = ChunkerState::End; - return Ready(Some(Err(err))); - } + }, + WebmElement::Info => {}, + WebmElement::Void => {}, + WebmElement::Unknown(_) => {}, + element => { + if let Err(err) = encode(element, buffer, chunker.buffer_size_limit) { + chunker.state = ChunkerState::End; + return Ready(Some(Err(err))); + } + }, }, Ok(Async::Ready(None)) => { // flush final Cluster on end of stream From d563baaca8f9f353ac9063a6f6ac9abb51b6fcda Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Sun, 17 Nov 2019 01:19:30 -0500 Subject: [PATCH 29/29] normalize stream_parser poll to use modern future types --- src/chunk.rs | 17 ++++++++--------- src/stream_parser.rs | 31 +++++++++++++++---------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/chunk.rs b/src/chunk.rs index 60a5066..e678868 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -1,5 +1,4 @@ use bytes::{Buf, Bytes}; -use futures::{Async}; use futures3::prelude::*; use std::{ io::Cursor, @@ -141,10 +140,10 @@ impl> + Unpin> Stream for Webm match chunker.state { ChunkerState::BuildingHeader(ref mut buffer) => { match chunker.source.poll_event(cx) { - Err(passthru) => return Ready(Some(Err(passthru))), - Ok(Async::NotReady) => return Pending, - Ok(Async::Ready(None)) => return Ready(None), - Ok(Async::Ready(Some(element))) => match element { + Ready(Some(Err(passthru))) => return Ready(Some(Err(passthru))), + Pending => return Pending, + Ready(None) => return Ready(None), + Ready(Some(Ok(element))) => match element { WebmElement::Cluster => { let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); let header_chunk = Chunk::Headers {bytes: Bytes::from(liberated_buffer.into_inner())}; @@ -169,9 +168,9 @@ impl> + Unpin> Stream for Webm }, ChunkerState::BuildingCluster(ref mut cluster_head, ref mut buffer) => { match chunker.source.poll_event(cx) { - Err(passthru) => return Ready(Some(Err(passthru))), - Ok(Async::NotReady) => return Pending, - Ok(Async::Ready(Some(element))) => match element { + Ready(Some(Err(passthru))) => return Ready(Some(Err(passthru))), + Pending => return Pending, + Ready(Some(Ok(element))) => match element { WebmElement::EbmlHead | WebmElement::Segment => { let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); @@ -222,7 +221,7 @@ impl> + Unpin> Stream for Webm } }, }, - Ok(Async::Ready(None)) => { + Ready(None) => { // flush final Cluster on end of stream let liberated_cluster_head = mem::replace(cluster_head, ClusterHead::new(0)); let liberated_buffer = mem::replace(buffer, Cursor::new(Vec::new())); diff --git a/src/stream_parser.rs b/src/stream_parser.rs index b9313ac..a2796f6 100644 --- a/src/stream_parser.rs +++ b/src/stream_parser.rs @@ -1,5 +1,4 @@ use bytes::{Buf, BufMut, Bytes, BytesMut}; -use futures::Async; use futures3::stream::{Stream, StreamExt, TryStream}; use std::task::{Context, Poll}; @@ -44,7 +43,7 @@ impl> + Unpin> EbmlStreamingPa pub fn poll_event<'a, T: FromEbml<'a>>( &'a mut self, cx: &mut Context, - ) -> Result>, WebmetroError> { + ) -> Poll>> { loop { match T::check_space(&self.buffer)? { None => { @@ -54,16 +53,16 @@ impl> + Unpin> EbmlStreamingPa let mut bytes = self.buffer.split_to(info.element_len).freeze(); bytes.advance(info.body_offset); self.borrowed = bytes; - return Ok(Async::Ready(Some(T::decode( + return Poll::Ready(Some(T::decode( info.element_id, &self.borrowed, - )?))); + ).map_err(Into::into))); } } if let Some(limit) = self.buffer_size_limit { if limit <= self.buffer.len() { - return Err(WebmetroError::ResourcesExceeded); + return Poll::Ready(Some(Err(WebmetroError::ResourcesExceeded))); } } @@ -73,8 +72,8 @@ impl> + Unpin> EbmlStreamingPa self.buffer.put(buf); // ok can retry decoding now } - Poll::Ready(None) => return Ok(Async::Ready(None)), - Poll::Pending => return Ok(Async::NotReady), + Poll::Ready(None) => return Poll::Ready(None), + Poll::Pending => return Poll::Pending, } } } @@ -114,9 +113,9 @@ impl> + Unpin> EbmlStreamingPa #[cfg(test)] mod tests { use bytes::IntoBuf; - use futures::Async::*; use futures3::{future::poll_fn, stream::StreamExt, FutureExt}; use matches::assert_matches; + use std::task::Poll::*; use crate::stream_parser::*; use crate::tests::ENCODE_WEBM_TEST_FILE; @@ -137,35 +136,35 @@ mod tests { assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::EbmlHead))) + Ready(Some(Ok(WebmElement::EbmlHead))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::Segment))) + Ready(Some(Ok(WebmElement::Segment))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::Tracks(_)))) + Ready(Some(Ok(WebmElement::Tracks(_)))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::Cluster))) + Ready(Some(Ok(WebmElement::Cluster))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::Timecode(0)))) + Ready(Some(Ok(WebmElement::Timecode(0)))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::SimpleBlock(_)))) + Ready(Some(Ok(WebmElement::SimpleBlock(_)))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::Cluster))) + Ready(Some(Ok(WebmElement::Cluster))) ); assert_matches!( stream_parser.poll_event(cx), - Ok(Ready(Some(WebmElement::Timecode(1000)))) + Ready(Some(Ok(WebmElement::Timecode(1000)))) ); std::task::Poll::Ready(())