From af908d72ebe86af6d600e0b5117e3d27440457c4 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 15 Jan 2019 15:30:17 +0200 Subject: [PATCH 001/179] Add dependencies for logger --- Cargo.toml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Cargo.toml diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000..a2099313c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "medea" +version = "0.1.0" +description = "Medea media server" +homepage = "https://github.com/instrumentisto/medea" +documentation = "https://github.com/instrumentisto/medea/tree/master/docs/rfc" +readme = "README.md" +edition = "2018" + +[dependencies] +chrono = "0.4.6" +log = "0.4.6" +slog = { version = "2.4.1", features = ["max_level_trace", "release_max_level_warn"] } +slog-async = "2.3.0" +slog-json = "2.3.0" +slog-scope = "4.1.1" +slog-stdlog = "3.0.4-pre" +slog-stream = "1.2.1" +slog-term = "2.4.0" From 023ac33f5a80a66f643ad835a33d18f53fcf5ebd Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 15 Jan 2019 17:40:38 +0200 Subject: [PATCH 002/179] Impl simple logger and dual logger --- Cargo.toml | 5 +---- src/log/mod.rs | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 35 +++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 src/log/mod.rs create mode 100644 src/main.rs diff --git a/Cargo.toml b/Cargo.toml index a2099313c..f9a551f49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,7 @@ edition = "2018" [dependencies] chrono = "0.4.6" log = "0.4.6" -slog = { version = "2.4.1", features = ["max_level_trace", "release_max_level_warn"] } +slog = { version = "2.4.1", features = ["max_level_info", "release_max_level_warn"] } slog-async = "2.3.0" slog-json = "2.3.0" slog-scope = "4.1.1" -slog-stdlog = "3.0.4-pre" -slog-stream = "1.2.1" -slog-term = "2.4.0" diff --git a/src/log/mod.rs b/src/log/mod.rs new file mode 100644 index 000000000..d3d20b322 --- /dev/null +++ b/src/log/mod.rs @@ -0,0 +1,56 @@ +use chrono::Local; +use slog::{o, Drain, Duplicate, FnValue, Fuse, Level, Logger, PushFnValue, Record}; +use slog_async::Async; +use slog_json::Json; +use std::io; + +/// Build app logger which prints all its logs to STDOUT, +/// but WARN level (and higher) logs to second writer. +/// All logs are written in JSON format with key-value pairs +/// such as level and timestamp. +pub fn new_dual_logger(w_out: W1, w_err: W2) -> Logger +where + W1: io::Write + Send + 'static, + W2: io::Write + Send + 'static, +{ + let drain_out = Json::new(w_out).build().fuse(); + let drain_err = Json::new(w_err).build().fuse(); + let drain = Duplicate( + drain_out.filter(|r| !r.level().is_at_least(Level::Warning)), + drain_err.filter_level(Level::Warning), + ) + .map(Fuse); + let drain = Async::new(drain).build().fuse(); + add_default_keys(Logger::root(drain, o!())) +} + +/// Build logger which writes all its logs to writer. +/// All logs are written in JSON format with key-value pairs +/// such as level and timestamp. +pub fn new_logger(w: W) -> Logger +where + W: io::Write + Send + 'static, +{ + let drain = Json::new(w).build().fuse(); + let drain = Async::new(drain).build().fuse(); + add_default_keys(Logger::root(drain, o!())) +} + +/// Add default key-values: +/// +/// * `time` - timestamp +/// * `lvl` - record logging level name +/// * `msg` - msg - formatted logging message +fn add_default_keys(logger: Logger) -> Logger { + logger.new(o!( + "msg" => PushFnValue(move |record : &Record, ser| { + ser.emit(record.msg()) + }), + "time" => PushFnValue(move |_ : &Record, ser| { + ser.emit(Local::now().to_rfc3339()) + }), + "lvl" => FnValue(move |rinfo : &Record| { + rinfo.level().as_str() + }), + )) +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 000000000..ff73e49b0 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,35 @@ +use slog::{o, slog_debug, slog_error, slog_info, slog_trace, slog_warn}; +use slog_scope::{debug, error, info, trace, warn}; + +mod log; + +fn main() { + let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); + let _scope_guard = slog_scope::set_global_logger(logger); + + error!("log error"); + + slog_scope::scope( + &slog_scope::logger().new(o!("scope-extra-data" => "data")), + || foo(), + ); + + info!("log info"); + warn!("log warning"); +} + +fn foo() { + info!("log info inside foo"); + + // scopes can be nested! + slog_scope::scope( + &slog_scope::logger().new(o!("even-more-scope-extra-data" => "data2")), + || bar(), + ); +} + +fn bar() { + info!("log info inside bar"); + debug!("debug"); + trace!("log trace"); +} From 5d4a315f63558f6cef358525aff01ee731bcf1fc Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 16 Jan 2019 11:12:26 +0200 Subject: [PATCH 003/179] Upd CHANGELOG --- CHANGELOG.md | 23 +++++++++++++++++++++++ src/log/mod.rs | 6 +++--- src/main.rs | 26 +------------------------- 3 files changed, 27 insertions(+), 28 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..74101c5ee --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +Change Log +========== + +All user visible changes to this project will be documented in this file. This project uses to [Semantic Versioning 2.0.0]. + + + + +## [0.1.0] · 2019-0?-?? + +[Milestone](/../milestones/1) | [Roadmap](/../issues/10) + +#### Implemented + +- Application log (!12) + + + + + +[0.1.0]: /../tree/v0.1.0 + +[Semantic Versioning 2.0.0]: https://semver.org diff --git a/src/log/mod.rs b/src/log/mod.rs index d3d20b322..774afd28f 100644 --- a/src/log/mod.rs +++ b/src/log/mod.rs @@ -13,8 +13,8 @@ where W1: io::Write + Send + 'static, W2: io::Write + Send + 'static, { - let drain_out = Json::new(w_out).build().fuse(); - let drain_err = Json::new(w_err).build().fuse(); + let drain_out = Json::new(w_out).build(); + let drain_err = Json::new(w_err).build(); let drain = Duplicate( drain_out.filter(|r| !r.level().is_at_least(Level::Warning)), drain_err.filter_level(Level::Warning), @@ -36,7 +36,7 @@ where add_default_keys(Logger::root(drain, o!())) } -/// Add default key-values: +/// Add default key-values for log: /// /// * `time` - timestamp /// * `lvl` - record logging level name diff --git a/src/main.rs b/src/main.rs index ff73e49b0..e376b7e32 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,29 +7,5 @@ fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); let _scope_guard = slog_scope::set_global_logger(logger); - error!("log error"); - - slog_scope::scope( - &slog_scope::logger().new(o!("scope-extra-data" => "data")), - || foo(), - ); - - info!("log info"); - warn!("log warning"); -} - -fn foo() { - info!("log info inside foo"); - - // scopes can be nested! - slog_scope::scope( - &slog_scope::logger().new(o!("even-more-scope-extra-data" => "data2")), - || bar(), - ); -} - -fn bar() { - info!("log info inside bar"); - debug!("debug"); - trace!("log trace"); + info!("Exit"); } From 74b4e127f3fa2a3c4498fbc7b131c331437b8ad1 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 16 Jan 2019 11:33:26 +0200 Subject: [PATCH 004/179] Remove CHANGELOG --- CHANGELOG.md | 23 --- Cargo.lock | 513 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 513 insertions(+), 23 deletions(-) delete mode 100644 CHANGELOG.md create mode 100644 Cargo.lock diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 74101c5ee..000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,23 +0,0 @@ -Change Log -========== - -All user visible changes to this project will be documented in this file. This project uses to [Semantic Versioning 2.0.0]. - - - - -## [0.1.0] · 2019-0?-?? - -[Milestone](/../milestones/1) | [Roadmap](/../issues/10) - -#### Implemented - -- Application log (!12) - - - - - -[0.1.0]: /../tree/v0.1.0 - -[Semantic Versioning 2.0.0]: https://semver.org diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 000000000..ae4dbe5f8 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,513 @@ +[[package]] +name = "arrayvec" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "autocfg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "chrono" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-channel" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-deque" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.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)", +] + +[[package]] +name = "crossbeam-utils" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "itoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libc" +version = "0.2.47" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lock_api" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "medea" +version = "0.1.0" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memoffset" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nodrop" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num-integer" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "num-traits" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "num_cpus" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "owning_ref" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (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.3.0 (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_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_os" +version = "0.1.1" +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-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.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 = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ryu" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde" +version = "1.0.84" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "serde_json" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "slog-async" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-json" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-scope" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stable_deref_trait" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "thread_local" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "time" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.6" +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)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" +"checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" +"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" +"checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" +"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"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 itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" +"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 memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" +"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" +"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 rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" +"checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_os 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f46fbd5550acf75b0c2730f5dd1873751daf9beb8f11b44027778fae50d7feca" +"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +"checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"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.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" +"checksum serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb1277d4d0563e4593e0b8b5d23d744d277b55d2bc0bf1c38d0d8a6589d38aa" +"checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" +"checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" +"checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" +"checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" +"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"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" From 52a65d35995a0d06d330d8daba035c362bd7c6c8 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 17 Jan 2019 12:31:03 +0200 Subject: [PATCH 005/179] Impl member and members repository --- Cargo.lock | 750 ++++++++++++++++++++++++++++++++++++++ Cargo.toml | 17 +- src/api/control/member.rs | 132 +++++++ src/api/mod.rs | 3 + src/errors/mod.rs | 7 + src/main.rs | 33 ++ 6 files changed, 936 insertions(+), 6 deletions(-) create mode 100644 src/api/control/member.rs create mode 100644 src/api/mod.rs create mode 100644 src/errors/mod.rs diff --git a/Cargo.lock b/Cargo.lock index ae4dbe5f8..26c65c7da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,47 @@ +[[package]] +name = "actix" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "actix_derive" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arc-swap" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "arrayvec" version = "0.4.10" @@ -11,11 +55,52 @@ name = "autocfg" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "backtrace" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byteorder" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytes" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.6" @@ -95,6 +180,39 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "error-chain" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -109,21 +227,94 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hostname" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "im" +version = "12.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ipconfig" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazycell" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "linked-hash-map" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lock_api" version = "0.1.5" @@ -141,16 +332,34 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lru-cache" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "medea" version = "0.1.0" dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -158,6 +367,55 @@ name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "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)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (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)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +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.47 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.13" @@ -213,6 +471,44 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.24" +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 = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.5.5" +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-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.6.4" @@ -239,6 +535,14 @@ dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.0" @@ -303,6 +607,20 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "resolv-conf" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc_version" version = "0.2.3" @@ -349,6 +667,20 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "signal-hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "slog" version = "2.4.1" @@ -393,11 +725,43 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "socket2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "syn" +version = "0.15.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (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 = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (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 = "take_mut" version = "0.2.2" @@ -421,6 +785,266 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-fs" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-signal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (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.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.47 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (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)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "trust-dns-proto" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "trust-dns-proto" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "typenum" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unreachable" version = "1.0.0" @@ -429,11 +1053,39 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (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)", +] + +[[package]] +name = "uuid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "widestring" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.6" @@ -443,6 +1095,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -453,10 +1110,43 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winreg" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winutil" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] +"checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" +"checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" +"checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" +"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -465,14 +1155,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0627d417829c1d763d602687634869f254fc79f7e22dea6c824dab993db857e4" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" +"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "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 lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" +"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 mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"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 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-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" @@ -480,8 +1189,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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 proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" @@ -490,6 +1205,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" @@ -497,17 +1214,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb1277d4d0563e4593e0b8b5d23d744d277b55d2bc0bf1c38d0d8a6589d38aa" +"checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" +"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" +"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" +"checksum tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9cbbc8a3698b7ab652340f46633364f9eaa928ddaaee79d8b8f356dd79a09d" +"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" +"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" +"checksum tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd6dc5276ea05ce379a16de90083ec80836440d5ef8a6a39545a3207373b8296" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"checksum tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17465013014410310f9f61fa10bf4724803c149ea1d51efece131c38efca93aa" +"checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" +"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" +"checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" +"checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" +"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"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" +"checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" +"checksum winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/Cargo.toml b/Cargo.toml index f9a551f49..1c5d72c06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,9 +8,14 @@ readme = "README.md" edition = "2018" [dependencies] -chrono = "0.4.6" -log = "0.4.6" -slog = { version = "2.4.1", features = ["max_level_info", "release_max_level_warn"] } -slog-async = "2.3.0" -slog-json = "2.3.0" -slog-scope = "4.1.1" +actix = "0.7" +chrono = "0.4" +failure = "0.1" +futures = "0.1" +im = "12.3" +log = "0.4" +slog = { version = "2.4", features = ["max_level_info", "release_max_level_warn"] } +slog-async = "2.3" +slog-json = "2.3" +slog-scope = "4.1" +tokio = "0.1" diff --git a/src/api/control/member.rs b/src/api/control/member.rs new file mode 100644 index 000000000..bb509b8c4 --- /dev/null +++ b/src/api/control/member.rs @@ -0,0 +1,132 @@ +use actix::prelude::*; +use im::hashmap::HashMap; + +use crate::errors::AppError; + +pub type Id = u64; + +#[derive(Clone)] +pub struct Member { + pub id: Id, + pub credentials: String, +} + +pub struct MemberRepository { + pub members: HashMap, +} + +impl Actor for MemberRepository { + type Context = Context; +} + +/// Message for retrieves member by its id. +pub struct GetMember(pub Id); + +impl Message for GetMember { + type Result = Result; +} + +impl Handler for MemberRepository { + type Result = Result; + + fn handle(&mut self, msg: GetMember, _: &mut Self::Context) -> Self::Result { + self.members + .get(&msg.0) + .map(|member| member.to_owned()) + .ok_or(AppError::NotFound) + } +} + +/// Message for retrieves member by its credential. +pub struct GetMemberByCredentials(pub String); + +impl Message for GetMemberByCredentials { + type Result = Result; +} + +impl Handler for MemberRepository { + type Result = Result; + + fn handle(&mut self, msg: GetMemberByCredentials, _: &mut Self::Context) -> Self::Result { + self.members + .values() + .find(|member| member.credentials.eq(&msg.0)) + .map(|member| member.to_owned()) + .ok_or(AppError::NotFound) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::time::{Duration, Instant}; + use tokio::prelude::*; + use tokio::timer::Delay; + + #[test] + fn test_get_member_by_id() { + System::run(move || { + let id = 2; + let members = HashMap::unit( + id, + Member { + id, + credentials: "credentials".to_owned(), + }, + ); + + let addr = Arbiter::builder().start(move |_| MemberRepository { members }); + + tokio::spawn( + addr.send(GetMember(id)) + .and_then(|res| { + assert!(res.is_ok()); + let member = res.unwrap(); + assert_eq!(member.id, 2); + Ok(()) + }) + .then(move |_| { + Delay::new(Instant::now() + Duration::new(0, 1_000_000)).then(move |_| { + System::current().stop(); + future::result(Ok(())) + }) + }), + ); + }); + } + + #[test] + fn test_get_member_by_credentials() { + System::run(move || { + let id = 2; + let cred = "credentials"; + let members = HashMap::unit( + id, + Member { + id, + credentials: cred.to_owned(), + }, + ); + + //let addr = SyncArbiter::start(1, || MemberRepository{members}); + let addr = Arbiter::builder().start(move |_| MemberRepository { members }); + + tokio::spawn( + addr.send(GetMemberByCredentials(cred.to_owned())) + .and_then(|res| { + assert!(res.is_ok()); + let member = res.unwrap(); + assert_eq!(member.id, 2); + assert_eq!(member.credentials, "credentials"); + Ok(()) + }) + .then(move |_| { + Delay::new(Instant::now() + Duration::new(0, 1_000_000)).then(move |_| { + System::current().stop(); + future::result(Ok(())) + }) + }), + ); + }); + } +} diff --git a/src/api/mod.rs b/src/api/mod.rs new file mode 100644 index 000000000..f7321d653 --- /dev/null +++ b/src/api/mod.rs @@ -0,0 +1,3 @@ +pub mod control { + pub mod member; +} diff --git a/src/errors/mod.rs b/src/errors/mod.rs new file mode 100644 index 000000000..b11852caf --- /dev/null +++ b/src/errors/mod.rs @@ -0,0 +1,7 @@ +use failure::Fail; + +#[derive(Fail, Debug)] +pub enum AppError { + #[fail(display = "Not found member")] + NotFound, +} diff --git a/src/main.rs b/src/main.rs index e376b7e32..64197e375 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,44 @@ +use actix::prelude::*; +use im::hashmap::HashMap; + use slog::{o, slog_debug, slog_error, slog_info, slog_trace, slog_warn}; use slog_scope::{debug, error, info, trace, warn}; +mod api; +mod errors; mod log; +use crate::api::control::member::{Member, MemberRepository}; + fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); let _scope_guard = slog_scope::set_global_logger(logger); + let sys = actix::System::new("medea"); + run(); + let _ = sys.run(); + info!("Exit"); } + +fn run() { + let mut members = HashMap::new(); + members.insert( + 1, + Member { + id: 1, + credentials: "user1_credentials".to_owned(), + }, + ); + members.insert( + 2, + Member { + id: 2, + credentials: "user2_credentials".to_owned(), + }, + ); + + let addr = Arbiter::builder().start(move |_| MemberRepository { members }); + + info!("Repository created"); +} From 122d780ad68c0495310b9d0a6c7e7be58753d338 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 18 Jan 2019 12:53:18 +0200 Subject: [PATCH 006/179] Impl handle WS connection --- .env | 1 + Cargo.lock | 728 +++++++++++++++++++++++++++++++++++++- Cargo.toml | 7 +- src/api/control/member.rs | 9 + src/log/mod.rs | 1 + src/main.rs | 40 +-- src/server.rs | 132 +++++++ 7 files changed, 885 insertions(+), 33 deletions(-) create mode 100644 .env create mode 100644 src/server.rs diff --git a/.env b/.env new file mode 100644 index 000000000..a7bcd3f21 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +RUST_LOG=debug diff --git a/Cargo.lock b/Cargo.lock index 26c65c7da..3d0e05f37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,82 @@ dependencies = [ "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "actix-net" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.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 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "actix-web" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.15 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (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)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "actix_derive" version = "0.3.2" @@ -37,6 +113,27 @@ dependencies = [ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "aho-corasick" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aho-corasick" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arc-swap" version = "0.3.7" @@ -77,11 +174,51 @@ dependencies = [ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.2.7" @@ -124,6 +261,38 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cookie" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crossbeam" version = "0.6.0" @@ -180,6 +349,78 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dotenv" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dtoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "error-chain" version = "0.8.1" @@ -208,6 +449,17 @@ dependencies = [ "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "flate2" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fnv" version = "1.0.6" @@ -232,6 +484,32 @@ name = "futures" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures-cpupool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "h2" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.14 (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)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hostname" version = "0.1.5" @@ -241,6 +519,21 @@ dependencies = [ "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "httparse" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "idna" version = "0.1.5" @@ -260,6 +553,11 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "indexmap" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "iovec" version = "0.1.2" @@ -281,6 +579,17 @@ dependencies = [ "winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "isatty" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" @@ -295,6 +604,11 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lazy_static" version = "1.2.0" @@ -324,6 +638,14 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.4.6" @@ -350,23 +672,91 @@ name = "medea" version = "0.1.0" dependencies = [ "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "memchr" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mime" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime_guess" +version = "2.0.0-alpha.6" +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)", +] + +[[package]] +name = "miniz-sys" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mio" version = "0.6.16" @@ -421,6 +811,14 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "nom" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-integer" version = "0.1.39" @@ -476,6 +874,41 @@ name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "phf" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.4.24" @@ -607,6 +1040,43 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "regex" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex-syntax" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "resolv-conf" version = "0.6.2" @@ -616,6 +1086,17 @@ dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ring" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.13" @@ -634,6 +1115,11 @@ name = "ryu" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "safemem" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "0.3.3" @@ -667,6 +1153,22 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_urlencoded" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "signal-hook" version = "0.1.7" @@ -676,6 +1178,11 @@ dependencies = [ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "slab" version = "0.4.2" @@ -696,6 +1203,20 @@ dependencies = [ "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slog-envlogger" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "slog-json" version = "2.3.0" @@ -717,6 +1238,29 @@ dependencies = [ "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slog-stdlog" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-term" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "smallvec" version = "0.6.7" @@ -741,6 +1285,11 @@ name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "string" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" version = "0.15.26" @@ -767,6 +1316,32 @@ name = "take_mut" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "term" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread-id" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread_local" version = "0.3.6" @@ -958,6 +1533,14 @@ dependencies = [ "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tower-service" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "trust-dns-proto" version = "0.5.0" @@ -1027,6 +1610,27 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicase" +version = "1.4.2" +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)", +] + +[[package]] +name = "unicase" +version = "2.2.0" +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)", +] + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -1053,16 +1657,32 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "untrusted" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (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)", ] +[[package]] +name = "utf8-ranges" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "uuid" version = "0.7.1" @@ -1071,6 +1691,41 @@ dependencies = [ "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "v_escape" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "v_escape_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v_escape_derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v_htmlescape" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "v_escape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "void" version = "1.0.2" @@ -1137,52 +1792,92 @@ dependencies = [ [metadata] "checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" +"checksum actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8bebfbe6629e0131730746718c9e032b58f02c6ce06ed7c982b9fef6c8545acd" +"checksum actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)" = "e9f33c941e5e69a58a6bfef33853228042ed3799fc4b5a4923a36a85776fb690" "checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e5f34df7a019573fb8bdc7e24a2bfebe51a2a1d6bfdbaeccedb3c41fc574727" "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2" +"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +"checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" "checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" +"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" +"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +"checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +"checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +"checksum encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +"checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" "checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum h2 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "30e0b8e55b4d7ffedade2b9605851f8e85f5010663e7ad170ef3c0f0681bc43f" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +"checksum http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "02096a6d2c55e63f7fcb800690e4f889a25f6ec342e3adb4594e293b625215ab" +"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0627d417829c1d763d602687634869f254fc79f7e22dea6c824dab993db857e4" +"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" +"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" "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 miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" +"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "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 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 nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" @@ -1190,6 +1885,10 @@ dependencies = [ "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 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.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" @@ -1205,27 +1904,43 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "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.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_json 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "dfb1277d4d0563e4593e0b8b5d23d744d277b55d2bc0bf1c38d0d8a6589d38aa" +"checksum serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d48f9f99cd749a2de71d29da5f948de7f2764cc5a9d7f3c97e3514d4ee6eabf2" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" +"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 slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7c6685180086bf58624e92cb3da5d5f013bebd609454926fc8e2ac6345d384b" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" +"checksum slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac42f8254ae996cc7d640f9410d3b048dcdf8887a10df4d5d4c44966de24c4a8" +"checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" +"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" +"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" @@ -1241,16 +1956,27 @@ dependencies = [ "checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b32f72af77f1bfe3d3d4da8516a238ebe7039b51dd8637a09841ac7f16d2c987" "checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" "checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" "checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" +"checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" +"checksum v_escape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b50688edb86f4c092a1a9fe8bda004b0faa3197100897653809e97e09a2814" +"checksum v_escape_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7cd994c63b487fef7aad31e5394ec04b9e24de7b32ea5251c9fb499cd2cbf44c" +"checksum v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "020cae817dc82693aa523f01087b291b1c7a9ac8cea5c12297963f21769fb27f" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/Cargo.toml b/Cargo.toml index 1c5d72c06..619caa63e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,12 +9,15 @@ edition = "2018" [dependencies] actix = "0.7" +actix-web = "0.7" chrono = "0.4" +dotenv = "0.13" failure = "0.1" futures = "0.1" im = "12.3" -log = "0.4" -slog = { version = "2.4", features = ["max_level_info", "release_max_level_warn"] } +slog = "2.4" +slog-envlogger = "2.1" +slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" diff --git a/src/api/control/member.rs b/src/api/control/member.rs index bb509b8c4..bb4e4078a 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -11,6 +11,15 @@ pub struct Member { pub credentials: String, } +const CALLER: Member = Member { + id: 1, + credentials: "caller_credentials".to_owned(), +}; +const RESPONDER: Member = Member { + id: 1, + credentials: "responder_credentials".to_owned(), +}; + pub struct MemberRepository { pub members: HashMap, } diff --git a/src/log/mod.rs b/src/log/mod.rs index 774afd28f..ed57335d1 100644 --- a/src/log/mod.rs +++ b/src/log/mod.rs @@ -20,6 +20,7 @@ where drain_err.filter_level(Level::Warning), ) .map(Fuse); + let drain = slog_envlogger::new(drain).fuse(); let drain = Async::new(drain).build().fuse(); add_default_keys(Logger::root(drain, o!())) } diff --git a/src/main.rs b/src/main.rs index 64197e375..a7ceb2520 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,44 +1,24 @@ -use actix::prelude::*; -use im::hashmap::HashMap; +pub use actix::prelude::*; +use dotenv::dotenv; -use slog::{o, slog_debug, slog_error, slog_info, slog_trace, slog_warn}; -use slog_scope::{debug, error, info, trace, warn}; +pub use slog::{o, slog_debug, slog_error, slog_info, slog_trace, slog_warn}; +pub use slog_scope::{debug, error, info, trace, warn}; -mod api; +pub mod api; mod errors; mod log; - -use crate::api::control::member::{Member, MemberRepository}; +mod server; fn main() { + dotenv().ok(); let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); let _scope_guard = slog_scope::set_global_logger(logger); + let _guard = slog_stdlog::init().unwrap(); let sys = actix::System::new("medea"); - run(); + init_repo(); + server::run(); let _ = sys.run(); info!("Exit"); } - -fn run() { - let mut members = HashMap::new(); - members.insert( - 1, - Member { - id: 1, - credentials: "user1_credentials".to_owned(), - }, - ); - members.insert( - 2, - Member { - id: 2, - credentials: "user2_credentials".to_owned(), - }, - ); - - let addr = Arbiter::builder().start(move |_| MemberRepository { members }); - - info!("Repository created"); -} diff --git a/src/server.rs b/src/server.rs new file mode 100644 index 000000000..b3441c28f --- /dev/null +++ b/src/server.rs @@ -0,0 +1,132 @@ +use crate::*; +use actix_web::{fs, http, middleware, server, ws, App, Error, HttpRequest, HttpResponse}; +use api::control::member::{Member, MemberRepository}; +use im::hashmap::HashMap; +use std::time::{Duration, Instant}; + +/// How often heartbeat pings are sent +const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); +/// How long before lack of client response causes a timeout +const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); + +/// do websocket handshake and start `WsSessions` actor +fn ws_index(r: &HttpRequest) -> Result { + ws::start(r, WsSessions::new()) +} + +fn index(r: &HttpRequest) -> Result { + Ok(HttpResponse::Ok().finish()) +} + +/// websocket connection is long running connection, it easier +/// to handle with an actor +struct WsSessions { + /// Client must send ping at least once per 10 seconds (CLIENT_TIMEOUT), + /// otherwise we drop connection. + hb: Instant, +} + +impl Actor for WsSessions { + type Context = ws::WebsocketContext; + + /// Method is called on actor start. We start the heartbeat process here. + fn started(&mut self, ctx: &mut Self::Context) { + self.hb(ctx); + } +} + +/// Handler for `ws::Message` +impl StreamHandler for WsSessions { + fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { + // process websocket messages + println!("WS: {:?}", msg); + match msg { + ws::Message::Ping(msg) => { + self.hb = Instant::now(); + ctx.pong(&msg); + } + ws::Message::Pong(_) => { + self.hb = Instant::now(); + } + ws::Message::Text(text) => ctx.text(text), + ws::Message::Binary(bin) => ctx.binary(bin), + ws::Message::Close(_) => { + ctx.stop(); + } + } + } +} + +impl WsSessions { + fn new() -> Self { + Self { hb: Instant::now() } + } + + /// helper method that sends ping to client every second. + /// + /// also this method checks heartbeats from client + fn hb(&self, ctx: &mut ::Context) { + ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { + // check client heartbeats + if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { + // heartbeat timed out + println!("Websocket Client heartbeat failed, disconnecting!"); + + // stop actor + ctx.stop(); + + // don't try to send a ping + return; + } + + ctx.ping(""); + }); + } +} + +/// State with repository address +struct AppState { + members_repo: Addr, +} + +pub fn run() { + server::new(|| { + with_state(AppState { + members_repo: addr.clone(), + }) + // enable logger + .middleware(middleware::Logger::default()) + // websocket route + .resource("/ws/", |r| r.method(http::Method::GET).f(ws_index)) + .resource("/get/", |r| r.method(http::Method::GET).f(index)) + }) + // start http server on 127.0.0.1:8080 + .bind("127.0.0.1:8080") + .unwrap() + .start(); + + println!("Started http server: 127.0.0.1:8080"); + trace!("Started http server: 127.0.0.1:8080"); +} + +fn init_repo() -> Addr { + let mut members = HashMap::new(); + members.insert( + 1, + Member { + id: 1, + credentials: "user1_credentials".to_owned(), + }, + ); + members.insert( + 2, + Member { + id: 2, + credentials: "user2_credentials".to_owned(), + }, + ); + + info!("Repository created"); + + Arbiter::builder().start(move |_| MemberRepository { members }) +} From d0d691f99ad0aae4670c5d2c24f4a1b761f18613 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 18 Jan 2019 15:16:08 +0200 Subject: [PATCH 007/179] Impl default caller and responder --- Cargo.lock | 751 +++++++++++++++++++++++++++++++++++++- src/api/control/member.rs | 101 ++--- src/main.rs | 24 +- 3 files changed, 811 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ddbe4f280..d89d03043 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,47 @@ +[[package]] +name = "actix" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", + "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "actix_derive" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "arc-swap" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "arrayvec" version = "0.4.10" @@ -11,11 +55,52 @@ name = "autocfg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "backtrace" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "byteorder" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bytes" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cc" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.6" @@ -95,6 +180,39 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "error-chain" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -109,21 +227,94 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "hostname" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "im" +version = "12.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "iovec" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ipconfig" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "lazy_static" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazycell" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "libc" version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "linked-hash-map" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lock_api" version = "0.1.5" @@ -141,16 +332,33 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "lru-cache" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "medea" version = "0.1.0" dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -158,6 +366,55 @@ name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mio" +version = "0.6.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "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)", + "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (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)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mio-uds" +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.47 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "ws2_32-sys 0.2.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "nodrop" version = "0.1.13" @@ -213,6 +470,44 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.25" +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 = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "quote" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.5.5" +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-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.6.4" @@ -239,6 +534,14 @@ dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.0" @@ -303,6 +606,20 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "resolv-conf" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc_version" version = "0.2.3" @@ -349,6 +666,20 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "signal-hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "slog" version = "2.4.1" @@ -393,11 +724,43 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "socket2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "syn" +version = "0.15.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (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 = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (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 = "take_mut" version = "0.2.2" @@ -421,6 +784,266 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-codec" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-current-thread" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-executor" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-fs" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-io" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-reactor" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-signal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-tcp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.16 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-threadpool" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-timer" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-udp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (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.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "tokio-uds" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.47 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (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)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "trust-dns-proto" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "trust-dns-proto" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "typenum" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unreachable" version = "1.0.0" @@ -429,11 +1052,39 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (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)", +] + +[[package]] +name = "uuid" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "widestring" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.6" @@ -443,6 +1094,11 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -453,10 +1109,43 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winreg" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winutil" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] +"checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" +"checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" +"checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" +"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" +"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -465,14 +1154,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0627d417829c1d763d602687634869f254fc79f7e22dea6c824dab993db857e4" +"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" +"checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" +"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "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 lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" +"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 mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"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 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-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" @@ -480,8 +1188,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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 proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" +"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" @@ -490,6 +1204,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" @@ -497,17 +1213,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" +"checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" +"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" +"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" +"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" +"checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" +"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" +"checksum tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9cbbc8a3698b7ab652340f46633364f9eaa928ddaaee79d8b8f356dd79a09d" +"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" +"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" +"checksum tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd6dc5276ea05ce379a16de90083ec80836440d5ef8a6a39545a3207373b8296" +"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" +"checksum tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17465013014410310f9f61fa10bf4724803c149ea1d51efece131c38efca93aa" +"checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" +"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" +"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" +"checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" +"checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" +"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"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" +"checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" +"checksum winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" +"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/src/api/control/member.rs b/src/api/control/member.rs index bb509b8c4..5f86482d8 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -2,6 +2,7 @@ use actix::prelude::*; use im::hashmap::HashMap; use crate::errors::AppError; +use crate::log::prelude::*; pub type Id = u64; @@ -15,6 +16,29 @@ pub struct MemberRepository { pub members: HashMap, } +/// Creates members repository with default Caller and Responder. +impl Default for MemberRepository { + fn default() -> Self { + let mut members = HashMap::new(); + members.insert( + 1, + Member { + id: 1, + credentials: "caller_credentials".to_owned(), + }, + ); + members.insert( + 2, + Member { + id: 2, + credentials: "responder_credentials".to_owned(), + }, + ); + info! {"Repository created"}; + MemberRepository { members } + } +} + impl Actor for MemberRepository { type Context = Context; } @@ -29,7 +53,11 @@ impl Message for GetMember { impl Handler for MemberRepository { type Result = Result; - fn handle(&mut self, msg: GetMember, _: &mut Self::Context) -> Self::Result { + fn handle( + &mut self, + msg: GetMember, + _: &mut Self::Context, + ) -> Self::Result { self.members .get(&msg.0) .map(|member| member.to_owned()) @@ -47,7 +75,11 @@ impl Message for GetMemberByCredentials { impl Handler for MemberRepository { type Result = Result; - fn handle(&mut self, msg: GetMemberByCredentials, _: &mut Self::Context) -> Self::Result { + fn handle( + &mut self, + msg: GetMemberByCredentials, + _: &mut Self::Context, + ) -> Self::Result { self.members .values() .find(|member| member.credentials.eq(&msg.0)) @@ -66,30 +98,22 @@ mod tests { #[test] fn test_get_member_by_id() { System::run(move || { - let id = 2; - let members = HashMap::unit( - id, - Member { - id, - credentials: "credentials".to_owned(), - }, - ); - - let addr = Arbiter::builder().start(move |_| MemberRepository { members }); + let addr = Arbiter::start(move |_| MemberRepository::default()); tokio::spawn( - addr.send(GetMember(id)) + addr.send(GetMember(1)) .and_then(|res| { assert!(res.is_ok()); let member = res.unwrap(); - assert_eq!(member.id, 2); + assert_eq!(member.id, 1); Ok(()) }) .then(move |_| { - Delay::new(Instant::now() + Duration::new(0, 1_000_000)).then(move |_| { - System::current().stop(); - future::result(Ok(())) - }) + Delay::new(Instant::now() + Duration::new(0, 1_000_000)) + .then(move |_| { + System::current().stop(); + future::result(Ok(())) + }) }), ); }); @@ -98,34 +122,29 @@ mod tests { #[test] fn test_get_member_by_credentials() { System::run(move || { - let id = 2; - let cred = "credentials"; - let members = HashMap::unit( - id, - Member { - id, - credentials: cred.to_owned(), - }, - ); - - //let addr = SyncArbiter::start(1, || MemberRepository{members}); - let addr = Arbiter::builder().start(move |_| MemberRepository { members }); + let addr = Arbiter::start(move |_| MemberRepository::default()); tokio::spawn( - addr.send(GetMemberByCredentials(cred.to_owned())) - .and_then(|res| { - assert!(res.is_ok()); - let member = res.unwrap(); - assert_eq!(member.id, 2); - assert_eq!(member.credentials, "credentials"); - Ok(()) - }) - .then(move |_| { - Delay::new(Instant::now() + Duration::new(0, 1_000_000)).then(move |_| { + addr.send(GetMemberByCredentials( + "responder_credentials".to_owned(), + )) + .and_then(|res| { + assert!(res.is_ok()); + let member = res.unwrap(); + assert_eq!(member.id, 2); + assert_eq!( + member.credentials, + "responder_credentials".to_owned() + ); + Ok(()) + }) + .then(move |_| { + Delay::new(Instant::now() + Duration::new(0, 1_000_000)) + .then(move |_| { System::current().stop(); future::result(Ok(())) }) - }), + }), ); }); } diff --git a/src/main.rs b/src/main.rs index 6965fdc9c..4f055ab27 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,31 +13,9 @@ fn main() { let _scope_guard = slog_scope::set_global_logger(logger); let sys = actix::System::new("medea"); - run(); + let addr = Arbiter::start(move |_| MemberRepository::default()); let _ = sys.run(); info!("Hooray!"); warn!("It works"); } - -fn run() { - let mut members = HashMap::new(); - members.insert( - 1, - Member { - id: 1, - credentials: "user1_credentials".to_owned(), - }, - ); - members.insert( - 2, - Member { - id: 2, - credentials: "user2_credentials".to_owned(), - }, - ); - - let addr = Arbiter::builder().start(move |_| MemberRepository { members }); - - info!("Repository created"); -} From 278116de81a3d26880368d4fe53a8de6c3c1f56e Mon Sep 17 00:00:00 2001 From: tyranron Date: Mon, 21 Jan 2019 12:26:00 +0200 Subject: [PATCH 008/179] Corrections --- src/api/control/member.rs | 6 ++++-- src/api/control/mod.rs | 3 +++ src/api/mod.rs | 4 +--- src/main.rs | 6 ++++-- 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 src/api/control/mod.rs diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 5f86482d8..eea560602 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,8 +1,10 @@ use actix::prelude::*; use im::hashmap::HashMap; -use crate::errors::AppError; -use crate::log::prelude::*; +use crate::{ + errors::AppError, + log::prelude::*, +}; pub type Id = u64; diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs new file mode 100644 index 000000000..d5d006c34 --- /dev/null +++ b/src/api/control/mod.rs @@ -0,0 +1,3 @@ +pub mod member; + +pub use self::member::{Member, MemberRepository}; diff --git a/src/api/mod.rs b/src/api/mod.rs index f7321d653..39958d49a 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,3 +1 @@ -pub mod control { - pub mod member; -} +pub mod control; diff --git a/src/main.rs b/src/main.rs index 4f055ab27..3538170ea 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,10 @@ use actix::prelude::*; use im::hashmap::HashMap; -use crate::api::control::member::{Member, MemberRepository}; -use crate::log::prelude::*; +use crate::{ + api::control::{Member, MemberRepository}, + log::prelude::*, +}; mod api; mod errors; From 61366f286081c7624356a2f41f2f505a1958423b Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 21 Jan 2019 14:02:24 +0200 Subject: [PATCH 009/179] Add state to context ws session --- Cargo.lock | 727 ++++++++++++++++++++++++++++++++++++++ src/api/control/member.rs | 12 +- src/main.rs | 2 +- src/server.rs | 61 ++-- 4 files changed, 758 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d89d03043..2245a96d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,82 @@ dependencies = [ "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "actix-net" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.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 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "actix-web" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.15 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (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)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "actix_derive" version = "0.3.2" @@ -37,6 +113,27 @@ dependencies = [ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "aho-corasick" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aho-corasick" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arc-swap" version = "0.3.7" @@ -77,11 +174,51 @@ dependencies = [ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.2.7" @@ -124,6 +261,38 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cookie" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crossbeam" version = "0.6.0" @@ -180,6 +349,78 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dotenv" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dtoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "error-chain" version = "0.8.1" @@ -208,6 +449,17 @@ dependencies = [ "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "flate2" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fnv" version = "1.0.6" @@ -232,6 +484,32 @@ name = "futures" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures-cpupool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "h2" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.14 (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)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hostname" version = "0.1.5" @@ -241,6 +519,21 @@ dependencies = [ "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "httparse" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "idna" version = "0.1.5" @@ -260,6 +553,11 @@ dependencies = [ "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "indexmap" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "iovec" version = "0.1.2" @@ -281,6 +579,17 @@ dependencies = [ "winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "isatty" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" @@ -295,6 +604,11 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lazy_static" version = "1.2.0" @@ -324,6 +638,14 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.4.6" @@ -350,22 +672,91 @@ name = "medea" version = "0.1.0" dependencies = [ "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "memchr" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mime" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime_guess" +version = "2.0.0-alpha.6" +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)", +] + +[[package]] +name = "miniz-sys" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mio" version = "0.6.16" @@ -420,6 +811,14 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "nom" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-integer" version = "0.1.39" @@ -475,6 +874,41 @@ name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "phf" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.4.25" @@ -606,6 +1040,43 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "regex" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex-syntax" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "resolv-conf" version = "0.6.2" @@ -615,6 +1086,17 @@ dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ring" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.13" @@ -633,6 +1115,11 @@ name = "ryu" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "safemem" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "0.3.3" @@ -666,6 +1153,22 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_urlencoded" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "signal-hook" version = "0.1.7" @@ -675,6 +1178,11 @@ dependencies = [ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "slab" version = "0.4.2" @@ -695,6 +1203,20 @@ dependencies = [ "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slog-envlogger" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "slog-json" version = "2.3.0" @@ -716,6 +1238,29 @@ dependencies = [ "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slog-stdlog" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-term" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "smallvec" version = "0.6.7" @@ -740,6 +1285,11 @@ name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "string" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" version = "0.15.26" @@ -766,6 +1316,32 @@ name = "take_mut" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "term" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread-id" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread_local" version = "0.3.6" @@ -957,6 +1533,14 @@ dependencies = [ "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tower-service" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "trust-dns-proto" version = "0.5.0" @@ -1026,6 +1610,27 @@ name = "typenum" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicase" +version = "1.4.2" +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)", +] + +[[package]] +name = "unicase" +version = "2.2.0" +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)", +] + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -1052,16 +1657,32 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "untrusted" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (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)", ] +[[package]] +name = "utf8-ranges" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "uuid" version = "0.7.1" @@ -1070,6 +1691,41 @@ dependencies = [ "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "v_escape" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "v_escape_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v_escape_derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v_htmlescape" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "v_escape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "void" version = "1.0.2" @@ -1136,52 +1792,92 @@ dependencies = [ [metadata] "checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" +"checksum actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8bebfbe6629e0131730746718c9e032b58f02c6ce06ed7c982b9fef6c8545acd" +"checksum actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)" = "e9f33c941e5e69a58a6bfef33853228042ed3799fc4b5a4923a36a85776fb690" "checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2" +"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +"checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" "checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" +"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" +"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +"checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +"checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +"checksum encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +"checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" "checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum h2 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "30e0b8e55b4d7ffedade2b9605851f8e85f5010663e7ad170ef3c0f0681bc43f" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +"checksum http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "02096a6d2c55e63f7fcb800690e4f889a25f6ec342e3adb4594e293b625215ab" +"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0627d417829c1d763d602687634869f254fc79f7e22dea6c824dab993db857e4" +"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" +"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum memchr 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "db4c41318937f6e76648f42826b1d9ade5c09cafb5aef7e351240a70f39206e9" "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 miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" +"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "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 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 nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" @@ -1189,6 +1885,10 @@ dependencies = [ "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 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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" @@ -1204,27 +1904,43 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "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.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" +"checksum serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d48f9f99cd749a2de71d29da5f948de7f2764cc5a9d7f3c97e3514d4ee6eabf2" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" +"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 slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7c6685180086bf58624e92cb3da5d5f013bebd609454926fc8e2ac6345d384b" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" +"checksum slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac42f8254ae996cc7d640f9410d3b048dcdf8887a10df4d5d4c44966de24c4a8" +"checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" +"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" +"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" @@ -1240,16 +1956,27 @@ dependencies = [ "checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b32f72af77f1bfe3d3d4da8516a238ebe7039b51dd8637a09841ac7f16d2c987" "checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" "checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" "checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" +"checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" +"checksum v_escape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b50688edb86f4c092a1a9fe8bda004b0faa3197100897653809e97e09a2814" +"checksum v_escape_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7cd994c63b487fef7aad31e5394ec04b9e24de7b32ea5251c9fb499cd2cbf44c" +"checksum v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "020cae817dc82693aa523f01087b291b1c7a9ac8cea5c12297963f21769fb27f" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 70b7523ae..08d2fbfcd 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -6,21 +6,13 @@ use crate::log::prelude::*; pub type Id = u64; -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Member { pub id: Id, pub credentials: String, } -const CALLER: Member = Member { - id: 1, - credentials: "caller_credentials".to_owned(), -}; -const RESPONDER: Member = Member { - id: 1, - credentials: "responder_credentials".to_owned(), -}; - +#[derive(Debug)] pub struct MemberRepository { pub members: HashMap, } diff --git a/src/main.rs b/src/main.rs index da5cf1b9e..4b58e18b2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -pub use actix::prelude::*; +use actix::prelude::*; use dotenv::dotenv; use crate::api::control::member::{Member, MemberRepository}; diff --git a/src/server.rs b/src/server.rs index b3441c28f..ee2ba7b6f 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,20 +1,23 @@ -use crate::*; -use actix_web::{fs, http, middleware, server, ws, App, Error, HttpRequest, HttpResponse}; -use api::control::member::{Member, MemberRepository}; -use im::hashmap::HashMap; use std::time::{Duration, Instant}; +use actix::prelude::*; +use actix_web::{fs, http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, State}; +use im::hashmap::HashMap; + +use crate::api::control::member::{GetMember, Member, MemberRepository}; +use crate::log::prelude::*; + /// How often heartbeat pings are sent const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); /// How long before lack of client response causes a timeout const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); /// do websocket handshake and start `WsSessions` actor -fn ws_index(r: &HttpRequest) -> Result { +fn ws_index(r: &HttpRequest) -> Result { ws::start(r, WsSessions::new()) } -fn index(r: &HttpRequest) -> Result { +fn index(r: &HttpRequest) -> Result { Ok(HttpResponse::Ok().finish()) } @@ -27,11 +30,24 @@ struct WsSessions { } impl Actor for WsSessions { - type Context = ws::WebsocketContext; + type Context = ws::WebsocketContext; /// Method is called on actor start. We start the heartbeat process here. fn started(&mut self, ctx: &mut Self::Context) { self.hb(ctx); + ctx.state() + .members_repo + .send(GetMember(1)) + .into_actor(self) + .then(|res, act, ctx| { + match res { + Ok(res) => debug!{"{:?}", res}, + // something is wrong with chat server + _ => ctx.stop(), + } + fut::ok(()) + }) + .wait(ctx); } } @@ -85,13 +101,15 @@ impl WsSessions { } /// State with repository address +#[derive(Debug)] struct AppState { members_repo: Addr, } pub fn run() { - server::new(|| { - with_state(AppState { + let addr = Arbiter::start(move |_| MemberRepository::default()); + server::new(move || { + App::with_state(AppState { members_repo: addr.clone(), }) // enable logger @@ -105,28 +123,5 @@ pub fn run() { .unwrap() .start(); - println!("Started http server: 127.0.0.1:8080"); - trace!("Started http server: 127.0.0.1:8080"); -} - -fn init_repo() -> Addr { - let mut members = HashMap::new(); - members.insert( - 1, - Member { - id: 1, - credentials: "user1_credentials".to_owned(), - }, - ); - members.insert( - 2, - Member { - id: 2, - credentials: "user2_credentials".to_owned(), - }, - ); - - info!("Repository created"); - - Arbiter::builder().start(move |_| MemberRepository { members }) + info!("Started http server: 127.0.0.1:8080"); } From 3ef7c30d07eea814a27e0e875a80123aa8685233 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 21 Jan 2019 16:57:52 +0200 Subject: [PATCH 010/179] Add hashmap macro --- Cargo.lock | 28 +++++++++-------------- Cargo.toml | 2 +- src/api/control/member.rs | 48 +++++++++++++-------------------------- src/main.rs | 10 ++++++-- src/utils/mod.rs | 31 +++++++++++++++++++++++++ 5 files changed, 67 insertions(+), 52 deletions(-) create mode 100644 src/utils/mod.rs diff --git a/Cargo.lock b/Cargo.lock index d89d03043..3a23d9a4a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -232,6 +232,15 @@ name = "futures" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "hashbrown" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hostname" version = "0.1.5" @@ -251,15 +260,6 @@ dependencies = [ "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "im" -version = "12.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "iovec" version = "0.1.2" @@ -353,7 +353,7 @@ dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1021,11 +1021,6 @@ dependencies = [ "trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "typenum" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-bidi" version = "0.3.4" @@ -1161,9 +1156,9 @@ 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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -"checksum im 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0627d417829c1d763d602687634869f254fc79f7e22dea6c824dab993db857e4" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" @@ -1243,7 +1238,6 @@ dependencies = [ "checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" "checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" "checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" -"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" diff --git a/Cargo.toml b/Cargo.toml index 40638520a..b0de53f9a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ actix = "0.7" chrono = "0.4" failure = "0.1" futures = "0.1" -im = "12.3" +hashbrown = "0.1" slog = { version = "2.4", features = ["max_level_info", "release_max_level_warn"] } slog-async = "2.3" slog-json = "2.3" diff --git a/src/api/control/member.rs b/src/api/control/member.rs index eea560602..369207621 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,10 +1,7 @@ use actix::prelude::*; -use im::hashmap::HashMap; +use hashbrown::HashMap; -use crate::{ - errors::AppError, - log::prelude::*, -}; +use crate::{errors::AppError, log::prelude::*}; pub type Id = u64; @@ -18,29 +15,6 @@ pub struct MemberRepository { pub members: HashMap, } -/// Creates members repository with default Caller and Responder. -impl Default for MemberRepository { - fn default() -> Self { - let mut members = HashMap::new(); - members.insert( - 1, - Member { - id: 1, - credentials: "caller_credentials".to_owned(), - }, - ); - members.insert( - 2, - Member { - id: 2, - credentials: "responder_credentials".to_owned(), - }, - ); - info! {"Repository created"}; - MemberRepository { members } - } -} - impl Actor for MemberRepository { type Context = Context; } @@ -97,10 +71,19 @@ mod tests { use tokio::prelude::*; use tokio::timer::Delay; + fn members() -> HashMap { + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + members + } + #[test] - fn test_get_member_by_id() { + fn returns_member_by_id() { System::run(move || { - let addr = Arbiter::start(move |_| MemberRepository::default()); + let members = members(); + let addr = Arbiter::start(move |_| MemberRepository { members }); tokio::spawn( addr.send(GetMember(1)) @@ -122,9 +105,10 @@ mod tests { } #[test] - fn test_get_member_by_credentials() { + fn returns_member_by_credentials() { System::run(move || { - let addr = Arbiter::start(move |_| MemberRepository::default()); + let members = members(); + let addr = Arbiter::start(move |_| MemberRepository { members }); tokio::spawn( addr.send(GetMemberByCredentials( diff --git a/src/main.rs b/src/main.rs index 3538170ea..1720766fd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,12 @@ use actix::prelude::*; -use im::hashmap::HashMap; use crate::{ api::control::{Member, MemberRepository}, log::prelude::*, }; +#[macro_use] +mod utils; mod api; mod errors; mod log; @@ -14,8 +15,13 @@ fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); let _scope_guard = slog_scope::set_global_logger(logger); + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + let sys = actix::System::new("medea"); - let addr = Arbiter::start(move |_| MemberRepository::default()); + let _addr = Arbiter::start(move |_| MemberRepository { members }); let _ = sys.run(); info!("Hooray!"); diff --git a/src/utils/mod.rs b/src/utils/mod.rs new file mode 100644 index 000000000..e12aa7346 --- /dev/null +++ b/src/utils/mod.rs @@ -0,0 +1,31 @@ +#[macro_export] +/// Create a **HashMap** from a list of key-value pairs. +/// +/// ## Example +/// +/// ``` +/// let map = hashmap! { +/// "a" => 1, +/// "b" => 2, +/// }; +/// assert_eq!(map["a"], 1); +/// assert_eq!(map["b"], 2); +/// assert_eq!(map.get("c"), None); +/// # } +/// ``` +macro_rules! hashmap { + (@single $($x:tt)*) => (()); + (@count $($rest:expr),*) => (<[()]>::len(&[$(hashmap!(@single $rest)),*])); + + ($($key:expr => $value:expr,)+) => { hashmap!($($key => $value),+) }; + ($($key:expr => $value:expr),*) => { + { + let _cap = hashmap!(@count $($key),*); + let mut _map = ::hashbrown::HashMap::with_capacity(_cap); + $( + let _ = _map.insert($key, $value); + )* + _map + } + }; +} From 747ab14ffc41a77095a44cac5721938f547c245b Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 22 Jan 2019 11:56:38 +0200 Subject: [PATCH 011/179] Impl control API errors --- src/api/control/member.rs | 48 +++++++++++++++++++++++++++++++++------ src/api/control/mod.rs | 2 +- src/errors/mod.rs | 5 ++-- 3 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 369207621..fa9e1c7b3 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,7 +1,14 @@ use actix::prelude::*; +use failure::Fail; use hashbrown::HashMap; -use crate::{errors::AppError, log::prelude::*}; +use crate::log::prelude::*; + +#[derive(Fail, Debug, PartialEq)] +pub enum ControlError { + #[fail(display = "Not found member")] + NotFound, +} pub type Id = u64; @@ -23,21 +30,22 @@ impl Actor for MemberRepository { pub struct GetMember(pub Id); impl Message for GetMember { - type Result = Result; + type Result = Result; } impl Handler for MemberRepository { - type Result = Result; + type Result = Result; fn handle( &mut self, msg: GetMember, _: &mut Self::Context, ) -> Self::Result { + debug!("GetMember message received"); self.members .get(&msg.0) .map(|member| member.to_owned()) - .ok_or(AppError::NotFound) + .ok_or(ControlError::NotFound) } } @@ -45,22 +53,23 @@ impl Handler for MemberRepository { pub struct GetMemberByCredentials(pub String); impl Message for GetMemberByCredentials { - type Result = Result; + type Result = Result; } impl Handler for MemberRepository { - type Result = Result; + type Result = Result; fn handle( &mut self, msg: GetMemberByCredentials, _: &mut Self::Context, ) -> Self::Result { + debug!("GetMemberByCredentials message received"); self.members .values() .find(|member| member.credentials.eq(&msg.0)) .map(|member| member.to_owned()) - .ok_or(AppError::NotFound) + .ok_or(ControlError::NotFound) } } @@ -134,4 +143,29 @@ mod tests { ); }); } + + #[test] + fn returns_error_not_found() { + System::run(move || { + let members = members(); + let addr = Arbiter::start(move |_| MemberRepository { members }); + + tokio::spawn( + addr.send(GetMember(999)) + .and_then(|res| { + assert!(res.is_err()); + // let member = res.unwrap(); + assert_eq!(res.err(), Some(ControlError::NotFound)); + Ok(()) + }) + .then(move |_| { + Delay::new(Instant::now() + Duration::new(0, 1_000_000)) + .then(move |_| { + System::current().stop(); + future::result(Ok(())) + }) + }), + ); + }); + } } diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs index d5d006c34..11c540824 100644 --- a/src/api/control/mod.rs +++ b/src/api/control/mod.rs @@ -1,3 +1,3 @@ pub mod member; -pub use self::member::{Member, MemberRepository}; +pub use self::member::{ControlError, Member, MemberRepository}; diff --git a/src/errors/mod.rs b/src/errors/mod.rs index b11852caf..c688fc8c7 100644 --- a/src/errors/mod.rs +++ b/src/errors/mod.rs @@ -1,7 +1,8 @@ +use crate::api::control::ControlError; use failure::Fail; #[derive(Fail, Debug)] pub enum AppError { - #[fail(display = "Not found member")] - NotFound, + #[fail(display = "Not implemented")] + Control(#[fail(cause)] ControlError), } From 8b8edb8953cb94b82cc17e0c3e5fcb5049b057af Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 25 Jan 2019 16:46:25 +0200 Subject: [PATCH 012/179] Impl WsSessionRepository --- Cargo.lock | 726 ++++++++++++++++++++++++++++++++++++++ src/api/client/mod.rs | 4 + src/api/client/server.rs | 80 +++++ src/api/client/session.rs | 201 +++++++++++ src/api/control/member.rs | 5 +- src/api/mod.rs | 1 + src/main.rs | 15 +- src/server.rs | 127 ------- 8 files changed, 1018 insertions(+), 141 deletions(-) create mode 100644 src/api/client/mod.rs create mode 100644 src/api/client/server.rs create mode 100644 src/api/client/session.rs delete mode 100644 src/server.rs diff --git a/Cargo.lock b/Cargo.lock index 3a23d9a4a..37fb92fa1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,82 @@ dependencies = [ "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "actix-net" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.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 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "actix-web" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (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.15 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazycell 1.2.1 (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)", + "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", + "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", + "v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "actix_derive" version = "0.3.2" @@ -37,6 +113,27 @@ dependencies = [ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "adler32" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "aho-corasick" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "aho-corasick" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arc-swap" version = "0.3.7" @@ -77,11 +174,51 @@ dependencies = [ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "base64" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "base64" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "brotli-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "brotli2" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "build_const" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byteorder" version = "1.2.7" @@ -124,6 +261,38 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cookie" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crc32fast" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "crossbeam" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "crossbeam" version = "0.6.0" @@ -180,6 +349,78 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dotenv" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dtoa" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "encoding" +version = "0.2.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-japanese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-korean" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-simpchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-singlebyte" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding-index-tradchinese" +version = "1.20141219.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "encoding_index_tests" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "error-chain" version = "0.8.1" @@ -208,6 +449,17 @@ dependencies = [ "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "flate2" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fnv" version = "1.0.6" @@ -232,6 +484,32 @@ name = "futures" version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "futures-cpupool" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "h2" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.11 (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.25 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.14 (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)", + "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "hashbrown" version = "0.1.8" @@ -250,6 +528,21 @@ dependencies = [ "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "httparse" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "idna" version = "0.1.5" @@ -260,6 +553,11 @@ dependencies = [ "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "indexmap" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "iovec" version = "0.1.2" @@ -281,6 +579,17 @@ dependencies = [ "winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "isatty" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itoa" version = "0.4.3" @@ -295,6 +604,11 @@ dependencies = [ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lazy_static" version = "1.2.0" @@ -324,6 +638,14 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "log" version = "0.4.6" @@ -350,22 +672,90 @@ name = "medea" version = "0.1.0" dependencies = [ "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "memchr" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "mime" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "mime_guess" +version = "2.0.0-alpha.6" +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)", +] + +[[package]] +name = "miniz-sys" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "miniz_oxide_c_api" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "mio" version = "0.6.16" @@ -420,6 +810,14 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "nom" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-integer" version = "0.1.39" @@ -475,6 +873,41 @@ name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "phf" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_codegen" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_generator" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "phf_shared" +version = "0.7.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.4.25" @@ -606,6 +1039,43 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "regex" +version = "0.1.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "regex-syntax" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "resolv-conf" version = "0.6.2" @@ -615,6 +1085,17 @@ dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ring" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rustc-demangle" version = "0.1.13" @@ -633,6 +1114,11 @@ name = "ryu" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "safemem" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "0.3.3" @@ -666,6 +1152,22 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_urlencoded" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "signal-hook" version = "0.1.7" @@ -675,6 +1177,11 @@ dependencies = [ "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "siphasher" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "slab" version = "0.4.2" @@ -695,6 +1202,20 @@ dependencies = [ "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slog-envlogger" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "slog-json" version = "2.3.0" @@ -716,6 +1237,29 @@ dependencies = [ "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "slog-stdlog" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "slog-term" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "smallvec" version = "0.6.7" @@ -740,6 +1284,11 @@ name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "string" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "syn" version = "0.15.26" @@ -766,6 +1315,32 @@ name = "take_mut" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "term" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread-id" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "thread_local" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread_local" version = "0.3.6" @@ -957,6 +1532,14 @@ dependencies = [ "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tower-service" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "trust-dns-proto" version = "0.5.0" @@ -1021,6 +1604,27 @@ dependencies = [ "trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicase" +version = "1.4.2" +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)", +] + +[[package]] +name = "unicase" +version = "2.2.0" +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)", +] + [[package]] name = "unicode-bidi" version = "0.3.4" @@ -1047,16 +1651,32 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "untrusted" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "url" version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (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)", ] +[[package]] +name = "utf8-ranges" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "uuid" version = "0.7.1" @@ -1065,6 +1685,41 @@ dependencies = [ "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "v_escape" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "v_escape_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v_escape_derive" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "v_htmlescape" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "v_escape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "void" version = "1.0.2" @@ -1131,52 +1786,92 @@ dependencies = [ [metadata] "checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" +"checksum actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8bebfbe6629e0131730746718c9e032b58f02c6ce06ed7c982b9fef6c8545acd" +"checksum actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)" = "e9f33c941e5e69a58a6bfef33853228042ed3799fc4b5a4923a36a85776fb690" "checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" +"checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" +"checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum base64 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "621fc7ecb8008f86d7fb9b95356cd692ce9514b80a86d85b397f32a22da7b9e2" +"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" +"checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" +"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1465f8134efa296b4c19db34d909637cb2bf0f7aaf21299e23e18fa29ac557cf" +"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum crc32fast 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e91d5240c6975ef33aeb5f148f35275c25eda8e8a5f95abe421978b05b8bf192" +"checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" "checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" +"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" +"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec" +"checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91" +"checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81" +"checksum encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7" +"checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" +"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" +"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" "checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" +"checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" +"checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" +"checksum h2 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "30e0b8e55b4d7ffedade2b9605851f8e85f5010663e7ad170ef3c0f0681bc43f" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" +"checksum http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "02096a6d2c55e63f7fcb800690e4f889a25f6ec342e3adb4594e293b625215ab" +"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "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 iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" +"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" +"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" "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 miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" +"checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" "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 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 nom 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9c349f68f25f596b9f44cf0e7c69752a5c633b0550c3ff849518bfba0233774a" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" @@ -1184,6 +1879,10 @@ dependencies = [ "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 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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" @@ -1199,27 +1898,43 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" +"checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" +"checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "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.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" +"checksum serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d48f9f99cd749a2de71d29da5f948de7f2764cc5a9d7f3c97e3514d4ee6eabf2" +"checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" "checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" +"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 slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" +"checksum slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7c6685180086bf58624e92cb3da5d5f013bebd609454926fc8e2ac6345d384b" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" +"checksum slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac42f8254ae996cc7d640f9410d3b048dcdf8887a10df4d5d4c44966de24c4a8" +"checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" +"checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" +"checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" @@ -1235,15 +1950,26 @@ dependencies = [ "checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" +"checksum tower-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b32f72af77f1bfe3d3d4da8516a238ebe7039b51dd8637a09841ac7f16d2c987" "checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" "checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" "checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" +"checksum unicase 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d3218ea14b4edcaccfa0df0a64a3792a2c32cc706f1b336e48867f9d3147f90" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "55cd1f4b4e96b46aeb8d4855db4a7a9bd96eeeb5c6a1ab54593328761642ce2f" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" +"checksum v_escape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c8b50688edb86f4c092a1a9fe8bda004b0faa3197100897653809e97e09a2814" +"checksum v_escape_derive 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7cd994c63b487fef7aad31e5394ec04b9e24de7b32ea5251c9fb499cd2cbf44c" +"checksum v_htmlescape 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "020cae817dc82693aa523f01087b291b1c7a9ac8cea5c12297963f21769fb27f" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs new file mode 100644 index 000000000..72e5481c4 --- /dev/null +++ b/src/api/client/mod.rs @@ -0,0 +1,4 @@ +pub mod server; +pub mod session; + +pub use self::{server::*, session::*}; diff --git a/src/api/client/server.rs b/src/api/client/server.rs new file mode 100644 index 000000000..3e844f384 --- /dev/null +++ b/src/api/client/server.rs @@ -0,0 +1,80 @@ +use std::time::{Duration, Instant}; + +use actix::prelude::*; +use actix_web::{ + http, middleware, server, ws, App, AsyncResponder, Error, FutureResponse, + HttpRequest, HttpResponse, Path, +}; +use futures::future::Future; + +use crate::{ + api::client::*, + api::control::member::{ + ControlError, GetMember, Id, Member, MemberRepository, + }, + log::prelude::*, +}; + +/// do websocket handshake and start `WsSessions` actor +fn ws_index( + (r, id): (HttpRequest<()>, Path), +) -> FutureResponse { + MemberRepository::from_registry() + .send(GetMember(id.into_inner())) + .from_err() + .and_then(move |res| match res { + Ok(res) => { + info!("{:?}", res); + WsSessionRepository::from_registry() + .send(IsConnected(res.id)) + .from_err() + .and_then(move |is_connected| { + info!("{:?}", is_connected); + if is_connected { + return Ok(HttpResponse::Conflict().into()); + } + ws::start(&r, WsSessions::new(res.id)) + }) + .wait() + } + Err(e) => match e { + ControlError::NotFound => Ok(HttpResponse::NotFound().into()), + _ => Ok(HttpResponse::InternalServerError().into()), + }, + }) + .responder() +} + +fn index(r: &HttpRequest<()>) -> Result { + Ok(HttpResponse::Ok().finish()) +} + +/// State with repository address +#[derive(Debug)] +pub struct AppState { + members_repo: Addr, +} + +pub fn run() { + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + + let addr = Arbiter::start(move |_| MemberRepository { members }); + System::current().registry().set(addr); + + server::new(move || { + App::new() + .middleware(middleware::Logger::default()) + .resource("/ws/{member_id}", |r| { + r.method(http::Method::GET).with(ws_index) + }) + .resource("/get/", |r| r.method(http::Method::GET).f(index)) + }) + .bind("127.0.0.1:8080") + .unwrap() + .start(); + + info!("Started http server: 127.0.0.1:8080"); +} diff --git a/src/api/client/session.rs b/src/api/client/session.rs new file mode 100644 index 000000000..64d416b83 --- /dev/null +++ b/src/api/client/session.rs @@ -0,0 +1,201 @@ +use std::time::{Duration, Instant}; + +use actix::prelude::*; +use actix_web::ws::CloseCode; +use actix_web::{ + http, middleware, server, ws, App, AsyncResponder, Error, FutureResponse, + HttpRequest, HttpResponse, Path, +}; +use failure::Fail; +use futures::future::Future; +use hashbrown::{hash_map::Entry, HashMap}; + +use crate::{ + api::client::*, + api::control::member::{ + ControlError, GetMember, Id, Member, MemberRepository, + }, + log::prelude::*, +}; + +#[derive(Fail, Debug, PartialEq)] +pub enum ClientError { + #[fail(display = "Session already exists")] + AlreadyExists, +} + +/// How often heartbeat pings are sent +const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); +/// How long before lack of client response causes a timeout +const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); + +/// websocket connection is long running connection, it easier +/// to handle with an actor +#[derive(Debug)] +pub struct WsSessions { + /// Client must send ping at least once per 10 seconds (CLIENT_TIMEOUT), + /// otherwise we drop connection. + hb: Instant, + member_id: Id, +} + +impl Actor for WsSessions { + type Context = ws::WebsocketContext; + + /// Method is called on actor start. We start the heartbeat process here. + fn started(&mut self, ctx: &mut Self::Context) { + self.hb(ctx); + let join_msg = JoinMember(self.member_id, ctx.address()); + WsSessionRepository::from_registry() + .send(join_msg) + .into_actor(self) + .then(|res, act, ctx| match res { + Ok(res) => { + info!("{:?}", res); + if let Err(_) = res { + ctx.close(Some( + ( + CloseCode::Normal, + "Member already connected!".to_owned(), + ) + .into(), + )); + ctx.stop(); + } + fut::ok(()) + } + _ => fut::ok(()), + }) + .spawn(ctx); + } +} + +/// Handler for `ws::Message` +impl StreamHandler for WsSessions { + fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { + // process websocket messages + println!("WS: {:?}", msg); + match msg { + ws::Message::Ping(msg) => { + self.hb = Instant::now(); + ctx.pong(&msg); + } + ws::Message::Pong(_) => { + self.hb = Instant::now(); + } + ws::Message::Text(text) => ctx.text(text), + ws::Message::Binary(bin) => ctx.binary(bin), + ws::Message::Close(_) => { + ctx.stop(); + } + } + } +} + +impl WsSessions { + pub fn new(member_id: Id) -> Self { + Self { + hb: Instant::now(), + member_id, + } + } + + /// helper method that sends ping to client every second. + /// + /// also this method checks heartbeats from client + fn hb(&self, ctx: &mut ::Context) { + ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { + // check client heartbeats + if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { + // heartbeat timed out + println!("Websocket Client heartbeat failed, disconnecting!"); + + // stop actor + ctx.stop(); + + // don't try to send a ping + return; + } + + ctx.ping(""); + }); + } +} + +#[derive(Clone)] +pub struct JoinMember(pub Id, pub Addr); + +impl Message for JoinMember { + type Result = Result<(), ClientError>; +} + +#[derive(Clone, Message)] +pub struct LeaveMember(pub Id); + +#[derive(Clone, Message)] +#[rtype(result = "bool")] +pub struct IsConnected(pub Id); + +impl Handler for WsSessionRepository { + type Result = MessageResult; + + fn handle( + &mut self, + msg: IsConnected, + _: &mut Self::Context, + ) -> Self::Result { + debug!("IsConnected message received"); + MessageResult(self.sessions.contains_key(&msg.0)) + } +} + +type Client = Addr; + +#[derive(Default)] +pub struct WsSessionRepository { + sessions: HashMap, +} + +impl Actor for WsSessionRepository { + type Context = Context; + + fn started(&mut self, ctx: &mut Self::Context) { + // self.subscribe_async::(ctx); + // self.subscribe_async::(ctx); + } +} + +impl Handler for WsSessionRepository { + type Result = Result<(), ClientError>; + + fn handle( + &mut self, + msg: JoinMember, + _ctx: &mut Self::Context, + ) -> Self::Result { + let JoinMember(id, client) = msg; + match self.sessions.get(&id) { + Some(_) => { + info!("{:?}", self.sessions); + Err(ClientError::AlreadyExists) + } + None => { + self.sessions.insert(id, client); + info!("{:?}", self.sessions); + Ok(()) + } + } + } +} + +impl Handler for WsSessionRepository { + type Result = (); + + fn handle(&mut self, msg: LeaveMember, _ctx: &mut Self::Context) { + self.sessions.remove(&msg.0); + info!("{:?}", self.sessions); + } +} + +impl SystemService for WsSessionRepository {} +impl Supervised for WsSessionRepository {} diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 5f8ca8e36..a47e12dbc 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -18,7 +18,7 @@ pub struct Member { pub credentials: String, } -#[derive(Debug)] +#[derive(Debug, Default)] pub struct MemberRepository { pub members: HashMap, } @@ -74,6 +74,9 @@ impl Handler for MemberRepository { } } +impl SystemService for MemberRepository {} +impl Supervised for MemberRepository {} + #[cfg(test)] mod tests { use super::*; diff --git a/src/api/mod.rs b/src/api/mod.rs index 39958d49a..eda6d8bd3 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1 +1,2 @@ +pub mod client; pub mod control; diff --git a/src/main.rs b/src/main.rs index a5d14d0bc..d5a2c50a6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,18 +1,13 @@ use actix::prelude::*; use dotenv::dotenv; -use im::hashmap::HashMap; -use crate::{ - api::control::{Member, MemberRepository}, - log::prelude::*, -}; +use crate::{api::client::*, log::prelude::*}; #[macro_use] mod utils; mod api; mod errors; mod log; -mod server; fn main() { dotenv().ok(); @@ -20,14 +15,8 @@ fn main() { let _scope_guard = slog_scope::set_global_logger(logger); let _guard = slog_stdlog::init().unwrap(); - let members = hashmap! { - 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, - }; - - let sys = actix::System::new("medea"); + let sys = System::new("medea"); server::run(); - let _addr = Arbiter::start(move |_| MemberRepository { members }); let _ = sys.run(); info!("Hooray!"); diff --git a/src/server.rs b/src/server.rs deleted file mode 100644 index ee2ba7b6f..000000000 --- a/src/server.rs +++ /dev/null @@ -1,127 +0,0 @@ -use std::time::{Duration, Instant}; - -use actix::prelude::*; -use actix_web::{fs, http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, State}; -use im::hashmap::HashMap; - -use crate::api::control::member::{GetMember, Member, MemberRepository}; -use crate::log::prelude::*; - -/// How often heartbeat pings are sent -const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); -/// How long before lack of client response causes a timeout -const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); - -/// do websocket handshake and start `WsSessions` actor -fn ws_index(r: &HttpRequest) -> Result { - ws::start(r, WsSessions::new()) -} - -fn index(r: &HttpRequest) -> Result { - Ok(HttpResponse::Ok().finish()) -} - -/// websocket connection is long running connection, it easier -/// to handle with an actor -struct WsSessions { - /// Client must send ping at least once per 10 seconds (CLIENT_TIMEOUT), - /// otherwise we drop connection. - hb: Instant, -} - -impl Actor for WsSessions { - type Context = ws::WebsocketContext; - - /// Method is called on actor start. We start the heartbeat process here. - fn started(&mut self, ctx: &mut Self::Context) { - self.hb(ctx); - ctx.state() - .members_repo - .send(GetMember(1)) - .into_actor(self) - .then(|res, act, ctx| { - match res { - Ok(res) => debug!{"{:?}", res}, - // something is wrong with chat server - _ => ctx.stop(), - } - fut::ok(()) - }) - .wait(ctx); - } -} - -/// Handler for `ws::Message` -impl StreamHandler for WsSessions { - fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { - // process websocket messages - println!("WS: {:?}", msg); - match msg { - ws::Message::Ping(msg) => { - self.hb = Instant::now(); - ctx.pong(&msg); - } - ws::Message::Pong(_) => { - self.hb = Instant::now(); - } - ws::Message::Text(text) => ctx.text(text), - ws::Message::Binary(bin) => ctx.binary(bin), - ws::Message::Close(_) => { - ctx.stop(); - } - } - } -} - -impl WsSessions { - fn new() -> Self { - Self { hb: Instant::now() } - } - - /// helper method that sends ping to client every second. - /// - /// also this method checks heartbeats from client - fn hb(&self, ctx: &mut ::Context) { - ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { - // check client heartbeats - if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { - // heartbeat timed out - println!("Websocket Client heartbeat failed, disconnecting!"); - - // stop actor - ctx.stop(); - - // don't try to send a ping - return; - } - - ctx.ping(""); - }); - } -} - -/// State with repository address -#[derive(Debug)] -struct AppState { - members_repo: Addr, -} - -pub fn run() { - let addr = Arbiter::start(move |_| MemberRepository::default()); - server::new(move || { - App::with_state(AppState { - members_repo: addr.clone(), - }) - // enable logger - .middleware(middleware::Logger::default()) - // websocket route - .resource("/ws/", |r| r.method(http::Method::GET).f(ws_index)) - .resource("/get/", |r| r.method(http::Method::GET).f(index)) - }) - // start http server on 127.0.0.1:8080 - .bind("127.0.0.1:8080") - .unwrap() - .start(); - - info!("Started http server: 127.0.0.1:8080"); -} From 04afc2d9e86183c0a4f6606efbeb845e646c4b00 Mon Sep 17 00:00:00 2001 From: tyranron Date: Mon, 28 Jan 2019 12:00:29 +0200 Subject: [PATCH 013/179] Some corrections --- src/errors/mod.rs | 3 ++- src/main.rs | 13 +++++++------ src/utils/mod.rs | 7 +++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/errors/mod.rs b/src/errors/mod.rs index c688fc8c7..bad3b6661 100644 --- a/src/errors/mod.rs +++ b/src/errors/mod.rs @@ -1,6 +1,7 @@ -use crate::api::control::ControlError; use failure::Fail; +use crate::api::control::ControlError; + #[derive(Fail, Debug)] pub enum AppError { #[fail(display = "Not implemented")] diff --git a/src/main.rs b/src/main.rs index 1720766fd..85b67f8d1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,13 +3,13 @@ use actix::prelude::*; use crate::{ api::control::{Member, MemberRepository}, log::prelude::*, + utils::hashmap, }; -#[macro_use] -mod utils; mod api; mod errors; mod log; +mod utils; fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); @@ -21,9 +21,10 @@ fn main() { }; let sys = actix::System::new("medea"); - let _addr = Arbiter::start(move |_| MemberRepository { members }); + let _addr = Arbiter::start(move |_| { + info!("Hooray!"); + warn!("It works"); + MemberRepository { members } + }); let _ = sys.run(); - - info!("Hooray!"); - warn!("It works"); } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index e12aa7346..4d2987ac9 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,9 +1,8 @@ -#[macro_export] -/// Create a **HashMap** from a list of key-value pairs. +/// Creates new [`::hashbrown::HashMap`] from a list of key-value pairs. /// /// ## Example /// -/// ``` +/// ```rust /// let map = hashmap! { /// "a" => 1, /// "b" => 2, @@ -11,8 +10,8 @@ /// assert_eq!(map["a"], 1); /// assert_eq!(map["b"], 2); /// assert_eq!(map.get("c"), None); -/// # } /// ``` +#[macro_export] macro_rules! hashmap { (@single $($x:tt)*) => (()); (@count $($rest:expr),*) => (<[()]>::len(&[$(hashmap!(@single $rest)),*])); From c00ad3115a067f5ca365b09e98cf1a0842a76c3f Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 28 Jan 2019 14:13:52 +0200 Subject: [PATCH 014/179] Impl remove session from repository --- Cargo.lock | 12 ++++++++ Cargo.toml | 1 + src/api/client/server.rs | 13 +++++---- src/api/client/session.rs | 61 ++++++++++----------------------------- 4 files changed, 36 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37fb92fa1..ca48398b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,16 @@ dependencies = [ "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "actix-broker" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "actix-net" version = "0.2.6" @@ -672,6 +682,7 @@ name = "medea" version = "0.1.0" dependencies = [ "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-broker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1786,6 +1797,7 @@ dependencies = [ [metadata] "checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" +"checksum actix-broker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6e35516b71d630755f23fc271db50009ee209f819087c0c1eb5abc10cc4b187b" "checksum actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8bebfbe6629e0131730746718c9e032b58f02c6ce06ed7c982b9fef6c8545acd" "checksum actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)" = "e9f33c941e5e69a58a6bfef33853228042ed3799fc4b5a4923a36a85776fb690" "checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" diff --git a/Cargo.toml b/Cargo.toml index 19669db86..625b5126c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ repository = "https://github.com/instrumentisto/medea" [dependencies] actix = "0.7" actix-web = "0.7" +actix-broker = "0.1" chrono = "0.4" dotenv = "0.13" failure = "0.1" diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 3e844f384..68fdb0b2c 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -10,19 +10,20 @@ use futures::future::Future; use crate::{ api::client::*, api::control::member::{ - ControlError, GetMember, Id, Member, MemberRepository, + ControlError, GetMemberByCredentials, Id, Member, MemberRepository, }, log::prelude::*, }; /// do websocket handshake and start `WsSessions` actor fn ws_index( - (r, id): (HttpRequest<()>, Path), + (r, creds): (HttpRequest<()>, Path), ) -> FutureResponse { + info!("{:?}", creds); MemberRepository::from_registry() - .send(GetMember(id.into_inner())) + .send(GetMemberByCredentials(creds.into_inner())) .from_err() - .and_then(move |res| match res { + .and_then(|res| match res { Ok(res) => { info!("{:?}", res); WsSessionRepository::from_registry() @@ -63,11 +64,13 @@ pub fn run() { let addr = Arbiter::start(move |_| MemberRepository { members }); System::current().registry().set(addr); + let addr2 = Arbiter::start(|_| WsSessionRepository::default()); + System::current().registry().set(addr2); server::new(move || { App::new() .middleware(middleware::Logger::default()) - .resource("/ws/{member_id}", |r| { + .resource("/ws/{credentials}", |r| { r.method(http::Method::GET).with(ws_index) }) .resource("/get/", |r| r.method(http::Method::GET).f(index)) diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 64d416b83..fc30e367f 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,6 +1,7 @@ use std::time::{Duration, Instant}; use actix::prelude::*; +use actix_broker::{BrokerIssue, BrokerSubscribe}; use actix_web::ws::CloseCode; use actix_web::{ http, middleware, server, ws, App, AsyncResponder, Error, FutureResponse, @@ -45,28 +46,13 @@ impl Actor for WsSessions { /// Method is called on actor start. We start the heartbeat process here. fn started(&mut self, ctx: &mut Self::Context) { self.hb(ctx); - let join_msg = JoinMember(self.member_id, ctx.address()); - WsSessionRepository::from_registry() - .send(join_msg) - .into_actor(self) - .then(|res, act, ctx| match res { - Ok(res) => { - info!("{:?}", res); - if let Err(_) = res { - ctx.close(Some( - ( - CloseCode::Normal, - "Member already connected!".to_owned(), - ) - .into(), - )); - ctx.stop(); - } - fut::ok(()) - } - _ => fut::ok(()), - }) - .spawn(ctx); + let msg = JoinMember(self.member_id, ctx.address()); + self.issue_async(msg); + } + + fn stopped(&mut self, ctx: &mut Self::Context) { + let msg = LeaveMember(self.member_id); + self.issue_async(msg); } } @@ -122,13 +108,9 @@ impl WsSessions { } } -#[derive(Clone)] +#[derive(Clone, Message)] pub struct JoinMember(pub Id, pub Addr); -impl Message for JoinMember { - type Result = Result<(), ClientError>; -} - #[derive(Clone, Message)] pub struct LeaveMember(pub Id); @@ -160,31 +142,18 @@ impl Actor for WsSessionRepository { type Context = Context; fn started(&mut self, ctx: &mut Self::Context) { - // self.subscribe_async::(ctx); - // self.subscribe_async::(ctx); + self.subscribe_async::(ctx); + self.subscribe_async::(ctx); } } impl Handler for WsSessionRepository { - type Result = Result<(), ClientError>; + type Result = (); - fn handle( - &mut self, - msg: JoinMember, - _ctx: &mut Self::Context, - ) -> Self::Result { + fn handle(&mut self, msg: JoinMember, _ctx: &mut Self::Context) { let JoinMember(id, client) = msg; - match self.sessions.get(&id) { - Some(_) => { - info!("{:?}", self.sessions); - Err(ClientError::AlreadyExists) - } - None => { - self.sessions.insert(id, client); - info!("{:?}", self.sessions); - Ok(()) - } - } + self.sessions.insert(id, client); + info!("{:?}", self.sessions); } } From 251b3e07471c7839a168e6e2143add67dfcc7929 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 28 Jan 2019 16:11:43 +0200 Subject: [PATCH 015/179] Remove impl actor for MemberRepository --- src/api/control/member.rs | 148 ++++++++++---------------------------- src/api/control/mod.rs | 2 +- src/errors/mod.rs | 2 + src/main.rs | 16 ++--- 4 files changed, 47 insertions(+), 121 deletions(-) diff --git a/src/api/control/member.rs b/src/api/control/member.rs index fa9e1c7b3..7c693a22e 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,73 +1,49 @@ -use actix::prelude::*; use failure::Fail; use hashbrown::HashMap; use crate::log::prelude::*; +/// This error type encompasses any error that can be returned by this crate. #[derive(Fail, Debug, PartialEq)] pub enum ControlError { #[fail(display = "Not found member")] NotFound, } +/// Id of Member. pub type Id = u64; -#[derive(Clone)] +/// Member represent user with its id and credentials. +#[derive(Clone, Debug)] pub struct Member { pub id: Id, pub credentials: String, } +/// Repository for store members. pub struct MemberRepository { pub members: HashMap, } -impl Actor for MemberRepository { - type Context = Context; -} - -/// Message for retrieves member by its id. -pub struct GetMember(pub Id); - -impl Message for GetMember { - type Result = Result; -} - -impl Handler for MemberRepository { - type Result = Result; - - fn handle( - &mut self, - msg: GetMember, - _: &mut Self::Context, - ) -> Self::Result { - debug!("GetMember message received"); +impl MemberRepository { + /// Returns member by its ID. + pub fn get_member(&self, id: Id) -> Result { + debug!("retrieve member by id: {}", id); self.members - .get(&msg.0) + .get(&id) .map(|member| member.to_owned()) .ok_or(ControlError::NotFound) } -} - -/// Message for retrieves member by its credential. -pub struct GetMemberByCredentials(pub String); - -impl Message for GetMemberByCredentials { - type Result = Result; -} - -impl Handler for MemberRepository { - type Result = Result; - fn handle( - &mut self, - msg: GetMemberByCredentials, - _: &mut Self::Context, - ) -> Self::Result { - debug!("GetMemberByCredentials message received"); + /// Returns member by its credentials. + pub fn get_member_by_credentials( + &self, + credentials: String, + ) -> Result { + debug!("retrieve member by credentials: {}", credentials); self.members .values() - .find(|member| member.credentials.eq(&msg.0)) + .find(|member| member.credentials.eq(&credentials)) .map(|member| member.to_owned()) .ok_or(ControlError::NotFound) } @@ -76,9 +52,6 @@ impl Handler for MemberRepository { #[cfg(test)] mod tests { use super::*; - use std::time::{Duration, Instant}; - use tokio::prelude::*; - use tokio::timer::Delay; fn members() -> HashMap { let members = hashmap! { @@ -90,82 +63,35 @@ mod tests { #[test] fn returns_member_by_id() { - System::run(move || { - let members = members(); - let addr = Arbiter::start(move |_| MemberRepository { members }); + let members = members(); + let repo = &MemberRepository { members }; - tokio::spawn( - addr.send(GetMember(1)) - .and_then(|res| { - assert!(res.is_ok()); - let member = res.unwrap(); - assert_eq!(member.id, 1); - Ok(()) - }) - .then(move |_| { - Delay::new(Instant::now() + Duration::new(0, 1_000_000)) - .then(move |_| { - System::current().stop(); - future::result(Ok(())) - }) - }), - ); - }); + let res = repo.get_member(1); + assert!(res.is_ok()); + let member = res.unwrap(); + assert_eq!(member.id, 1); } #[test] fn returns_member_by_credentials() { - System::run(move || { - let members = members(); - let addr = Arbiter::start(move |_| MemberRepository { members }); - - tokio::spawn( - addr.send(GetMemberByCredentials( - "responder_credentials".to_owned(), - )) - .and_then(|res| { - assert!(res.is_ok()); - let member = res.unwrap(); - assert_eq!(member.id, 2); - assert_eq!( - member.credentials, - "responder_credentials".to_owned() - ); - Ok(()) - }) - .then(move |_| { - Delay::new(Instant::now() + Duration::new(0, 1_000_000)) - .then(move |_| { - System::current().stop(); - future::result(Ok(())) - }) - }), - ); - }); + let members = members(); + let repo = &MemberRepository { members }; + + let res = + repo.get_member_by_credentials("responder_credentials".to_owned()); + assert!(res.is_ok()); + let member = res.unwrap(); + assert_eq!(member.id, 2); + assert_eq!(member.credentials, "responder_credentials".to_owned()); } #[test] fn returns_error_not_found() { - System::run(move || { - let members = members(); - let addr = Arbiter::start(move |_| MemberRepository { members }); + let members = members(); + let repo = &MemberRepository { members }; - tokio::spawn( - addr.send(GetMember(999)) - .and_then(|res| { - assert!(res.is_err()); - // let member = res.unwrap(); - assert_eq!(res.err(), Some(ControlError::NotFound)); - Ok(()) - }) - .then(move |_| { - Delay::new(Instant::now() + Duration::new(0, 1_000_000)) - .then(move |_| { - System::current().stop(); - future::result(Ok(())) - }) - }), - ); - }); + let res = repo.get_member(999); + assert!(res.is_err()); + assert_eq!(res.err(), Some(ControlError::NotFound)); } } diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs index 11c540824..9dd654c2a 100644 --- a/src/api/control/mod.rs +++ b/src/api/control/mod.rs @@ -1,3 +1,3 @@ pub mod member; -pub use self::member::{ControlError, Member, MemberRepository}; +pub use self::member::{ControlError, Id, Member, MemberRepository}; diff --git a/src/errors/mod.rs b/src/errors/mod.rs index bad3b6661..da39a82d2 100644 --- a/src/errors/mod.rs +++ b/src/errors/mod.rs @@ -2,8 +2,10 @@ use failure::Fail; use crate::api::control::ControlError; +/// This type of error covers any error that may occur in this application. #[derive(Fail, Debug)] pub enum AppError { + /// This error encompasses any error that can be returned from Control API. #[fail(display = "Not implemented")] Control(#[fail(cause)] ControlError), } diff --git a/src/main.rs b/src/main.rs index 85b67f8d1..4dbefceee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,14 @@ -use actix::prelude::*; - use crate::{ api::control::{Member, MemberRepository}, log::prelude::*, - utils::hashmap, }; +#[macro_use] +mod utils; + mod api; mod errors; mod log; -mod utils; fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); @@ -20,11 +19,10 @@ fn main() { 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let sys = actix::System::new("medea"); - let _addr = Arbiter::start(move |_| { + let repo = MemberRepository { members }; + if let Ok(member) = repo.get_member(1) { + info!("{:?}", member); info!("Hooray!"); warn!("It works"); - MemberRepository { members } - }); - let _ = sys.run(); + } } From f22945eb851bc0de0bd42eb1a2de681eff12591b Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 29 Jan 2019 10:35:30 +0200 Subject: [PATCH 016/179] Remove unused crates --- Cargo.lock | 630 ----------------------------------------------------- Cargo.toml | 3 - 2 files changed, 633 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3a23d9a4a..a6f8edd65 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,47 +1,3 @@ -[[package]] -name = "actix" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (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.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "actix_derive" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "arc-swap" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "arrayvec" version = "0.4.10" @@ -87,15 +43,6 @@ name = "byteorder" version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "bytes" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "cc" version = "1.0.28" @@ -180,14 +127,6 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "error-chain" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "failure" version = "0.1.5" @@ -208,11 +147,6 @@ dependencies = [ "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "fnv" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -227,11 +161,6 @@ name = "fuchsia-zircon-sys" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "futures" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "hashbrown" version = "0.1.8" @@ -241,80 +170,21 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "hostname" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "iovec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ipconfig" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itoa" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "lazy_static" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "lazycell" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "libc" version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "linked-hash-map" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "lock_api" version = "0.1.5" @@ -324,41 +194,17 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "log" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lru-cache" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "medea" version = "0.1.0" dependencies = [ - "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -366,55 +212,6 @@ name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "mio" -version = "0.6.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "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)", - "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (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)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "mio-uds" -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.47 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "ws2_32-sys 0.2.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "nodrop" version = "0.1.13" @@ -470,11 +267,6 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "proc-macro2" version = "0.4.25" @@ -483,11 +275,6 @@ dependencies = [ "unicode-xid 0.1.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 = "0.6.10" @@ -496,18 +283,6 @@ dependencies = [ "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand" -version = "0.5.5" -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-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand" version = "0.6.4" @@ -534,14 +309,6 @@ dependencies = [ "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "rand_core" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand_core" version = "0.3.0" @@ -606,15 +373,6 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "resolv-conf" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rustc-demangle" version = "0.1.13" @@ -666,20 +424,6 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "signal-hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "slog" version = "2.4.1" @@ -724,17 +468,6 @@ dependencies = [ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "socket2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "stable_deref_trait" version = "1.1.1" @@ -784,256 +517,6 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "tokio" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-codec" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-executor" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-fs" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-io" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.7.1 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-signal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", - "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (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.16 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-timer" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (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.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-udp" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (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.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-uds" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (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.47 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (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)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "trust-dns-proto" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "trust-dns-proto" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "trust-dns-resolver" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" version = "0.1.0" @@ -1047,39 +530,11 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "idna 0.1.5 (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)", -] - -[[package]] -name = "uuid" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "void" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "widestring" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "winapi" version = "0.3.6" @@ -1089,11 +544,6 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -1104,42 +554,13 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "winreg" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winutil" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [metadata] -"checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" -"checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" -"checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" "checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" @@ -1149,33 +570,16 @@ dependencies = [ "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" -"checksum error-chain 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6930e04918388a9a2e41d518c25cf679ccafe26733fb4127dbf21993f2575d46" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "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.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" -"checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" -"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "08f7eadeaf4b52700de180d147c4805f199854600b36faa963d91114827b2ffc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" -"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" -"checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" "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 lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4d06ff7ff06f729ce5f4e227876cb88d10bc59cd4ae1e09fbb2bde15c850dc21" -"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 mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" -"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 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-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" @@ -1183,14 +587,10 @@ dependencies = [ "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 proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" @@ -1199,7 +599,6 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" -"checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" @@ -1208,49 +607,20 @@ dependencies = [ "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" -"checksum signal-hook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f272d1b7586bec132ed427f532dd418d8beca1ca7f2caf7df35569b1415a4b4" -"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" -"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4790d0be6f4ba6ae4f48190efa2ed7780c9e3567796abdb285003cf39840d9c5" -"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" -"checksum tokio-current-thread 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "331c8acc267855ec06eb0c94618dcbbfea45bed2d20b77252940095273fb58f6" -"checksum tokio-executor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30c6dbf2d1ad1de300b393910e8a3aa272b724a400b6531da03eed99e329fbf0" -"checksum tokio-fs 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e9cbbc8a3698b7ab652340f46633364f9eaa928ddaaee79d8b8f356dd79a09d" -"checksum tokio-io 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b53aeb9d3f5ccf2ebb29e19788f96987fa1355f8fe45ea193928eaaaf3ae820f" -"checksum tokio-reactor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "afbcdb0f0d2a1e4c440af82d7bbf0bf91a8a8c0575bcd20c05d15be7e9d3a02f" -"checksum tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd6dc5276ea05ce379a16de90083ec80836440d5ef8a6a39545a3207373b8296" -"checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" -"checksum tokio-threadpool 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "17465013014410310f9f61fa10bf4724803c149ea1d51efece131c38efca93aa" -"checksum tokio-timer 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4f37f0111d76cc5da132fe9bc0590b9b9cfd079bc7e75ac3846278430a299ff8" -"checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" -"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" -"checksum trust-dns-proto 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0838272e89f1c693b4df38dc353412e389cf548ceed6f9fd1af5a8d6e0e7cf74" -"checksum trust-dns-proto 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30dde452f5d142d5e316a3b32386da95280c98b7e266639f8f3bc6fdf507d279" -"checksum trust-dns-resolver 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de630f95a192f793436ffae5137e88253cc4142a97d9a8e73c8d804fa85ddf0a" -"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" -"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -"checksum uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dab5c5526c5caa3d106653401a267fed923e7046f35895ffcb5ca42db64942e6" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum widestring 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7157704c2e12e3d2189c507b7482c52820a16dfa4465ba91add92f266667cadb" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" -"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" -"checksum winreg 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" -"checksum winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e" -"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" diff --git a/Cargo.toml b/Cargo.toml index b0de53f9a..2bbdded1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,13 +10,10 @@ readme = "README.md" repository = "https://github.com/instrumentisto/medea" [dependencies] -actix = "0.7" chrono = "0.4" failure = "0.1" -futures = "0.1" hashbrown = "0.1" slog = { version = "2.4", features = ["max_level_info", "release_max_level_warn"] } slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" -tokio = "0.1" From 0e854d0727b3d5ca9d1f5b806bc5f43ab141aab5 Mon Sep 17 00:00:00 2001 From: tyranron Date: Tue, 29 Jan 2019 17:27:57 +0200 Subject: [PATCH 017/179] Fill up missing docs --- src/api/control/member.rs | 17 +++++++++++------ src/api/control/mod.rs | 2 ++ src/api/mod.rs | 2 ++ src/errors/mod.rs | 6 ++++-- src/main.rs | 6 +++--- src/utils/mod.rs | 2 ++ 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 7c693a22e..ca4c94711 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,32 +1,37 @@ +//! Member definitions and implementations. + use failure::Fail; use hashbrown::HashMap; use crate::log::prelude::*; -/// This error type encompasses any error that can be returned by this crate. +/// Error that can be returned by Control API. #[derive(Fail, Debug, PartialEq)] pub enum ControlError { + /// [`Member`] is not found in repository. #[fail(display = "Not found member")] NotFound, } -/// Id of Member. +/// ID of [`Member`]. pub type Id = u64; -/// Member represent user with its id and credentials. +/// Media server user with its ID and credentials. #[derive(Clone, Debug)] pub struct Member { + /// ID of [`Member`]. pub id: Id, + /// Credentials to authorize [`Member`] with. pub credentials: String, } -/// Repository for store members. +/// Repository that stores store [`Member`]s. pub struct MemberRepository { pub members: HashMap, } impl MemberRepository { - /// Returns member by its ID. + /// Returns [`Member`] by its ID. pub fn get_member(&self, id: Id) -> Result { debug!("retrieve member by id: {}", id); self.members @@ -35,7 +40,7 @@ impl MemberRepository { .ok_or(ControlError::NotFound) } - /// Returns member by its credentials. + /// Returns [`Member`] by its credentials. pub fn get_member_by_credentials( &self, credentials: String, diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs index 9dd654c2a..c20222f72 100644 --- a/src/api/control/mod.rs +++ b/src/api/control/mod.rs @@ -1,3 +1,5 @@ +//! Implementation of Control API. + pub mod member; pub use self::member::{ControlError, Id, Member, MemberRepository}; diff --git a/src/api/mod.rs b/src/api/mod.rs index 39958d49a..3c2414f0c 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1 +1,3 @@ +//! API implementations provided by application. + pub mod control; diff --git a/src/errors/mod.rs b/src/errors/mod.rs index da39a82d2..12dcf5296 100644 --- a/src/errors/mod.rs +++ b/src/errors/mod.rs @@ -1,11 +1,13 @@ +//! Common errors used in application. + use failure::Fail; use crate::api::control::ControlError; -/// This type of error covers any error that may occur in this application. +/// Any error that may occur in this application. #[derive(Fail, Debug)] pub enum AppError { - /// This error encompasses any error that can be returned from Control API. + /// Error returned from Control API. #[fail(display = "Not implemented")] Control(#[fail(cause)] ControlError), } diff --git a/src/main.rs b/src/main.rs index 4dbefceee..cafc65439 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,14 +1,14 @@ +//! Medea media server application. + use crate::{ api::control::{Member, MemberRepository}, log::prelude::*, }; -#[macro_use] -mod utils; - mod api; mod errors; mod log; +#[macro_use] mod utils; fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 4d2987ac9..cfc1b0155 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,3 +1,5 @@ +//! Helper utils used in project. + /// Creates new [`::hashbrown::HashMap`] from a list of key-value pairs. /// /// ## Example From 4bb609697903759f291f419fb3964787aa0f6201 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 30 Jan 2019 10:46:38 +0200 Subject: [PATCH 018/179] Remove impl actor for WsSessionRepository --- Cargo.lock | 2 + src/api/client/server.rs | 80 +++++++++++++++++---------------------- src/api/client/session.rs | 78 ++++++++------------------------------ src/main.rs | 6 +-- 4 files changed, 53 insertions(+), 113 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca48398b7..58608fc6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "actix" version = "0.7.9" diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 68fdb0b2c..5359b9d3b 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -1,59 +1,46 @@ -use std::time::{Duration, Instant}; +use std::sync::{Arc, Mutex}; -use actix::prelude::*; use actix_web::{ - http, middleware, server, ws, App, AsyncResponder, Error, FutureResponse, - HttpRequest, HttpResponse, Path, + http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, Path, + State, }; -use futures::future::Future; use crate::{ api::client::*, - api::control::member::{ - ControlError, GetMemberByCredentials, Id, Member, MemberRepository, - }, + api::control::member::{ControlError, Member, MemberRepository}, log::prelude::*, }; /// do websocket handshake and start `WsSessions` actor fn ws_index( - (r, creds): (HttpRequest<()>, Path), -) -> FutureResponse { + (r, creds, state): (HttpRequest, Path, State), +) -> Result { info!("{:?}", creds); - MemberRepository::from_registry() - .send(GetMemberByCredentials(creds.into_inner())) - .from_err() - .and_then(|res| match res { - Ok(res) => { - info!("{:?}", res); - WsSessionRepository::from_registry() - .send(IsConnected(res.id)) - .from_err() - .and_then(move |is_connected| { - info!("{:?}", is_connected); - if is_connected { - return Ok(HttpResponse::Conflict().into()); - } - ws::start(&r, WsSessions::new(res.id)) - }) - .wait() + let member_repo = state.members_repo.lock().unwrap(); + match member_repo.get_member_by_credentials(creds.into_inner()) { + Ok(member) => { + let session_repo = state.session_repo.lock().unwrap(); + if session_repo.is_connected(member.id) { + Ok(HttpResponse::Conflict().finish()) + } else { + ws::start(&r, WsSessions::new(member.id)) } - Err(e) => match e { - ControlError::NotFound => Ok(HttpResponse::NotFound().into()), - _ => Ok(HttpResponse::InternalServerError().into()), - }, - }) - .responder() + } + Err(e) => match e { + ControlError::NotFound => Ok(HttpResponse::NotFound().finish()), + _ => Ok(HttpResponse::InternalServerError().finish()), + }, + } } -fn index(r: &HttpRequest<()>) -> Result { +fn index(_r: &HttpRequest) -> Result { Ok(HttpResponse::Ok().finish()) } /// State with repository address -#[derive(Debug)] pub struct AppState { - members_repo: Addr, + pub members_repo: Arc>, + pub session_repo: Arc>, } pub fn run() { @@ -62,18 +49,19 @@ pub fn run() { 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let addr = Arbiter::start(move |_| MemberRepository { members }); - System::current().registry().set(addr); - let addr2 = Arbiter::start(|_| WsSessionRepository::default()); - System::current().registry().set(addr2); + let members_repo = Arc::new(Mutex::new(MemberRepository { members })); + let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); server::new(move || { - App::new() - .middleware(middleware::Logger::default()) - .resource("/ws/{credentials}", |r| { - r.method(http::Method::GET).with(ws_index) - }) - .resource("/get/", |r| r.method(http::Method::GET).f(index)) + App::with_state(AppState { + members_repo: members_repo.clone(), + session_repo: session_repo.clone(), + }) + .middleware(middleware::Logger::default()) + .resource("/ws/{credentials}", |r| { + r.method(http::Method::GET).with(ws_index) + }) + .resource("/", |r| r.method(http::Method::GET).f(index)) }) .bind("127.0.0.1:8080") .unwrap() diff --git a/src/api/client/session.rs b/src/api/client/session.rs index fc30e367f..b21723425 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,27 +1,19 @@ use std::time::{Duration, Instant}; use actix::prelude::*; -use actix_broker::{BrokerIssue, BrokerSubscribe}; -use actix_web::ws::CloseCode; -use actix_web::{ - http, middleware, server, ws, App, AsyncResponder, Error, FutureResponse, - HttpRequest, HttpResponse, Path, -}; +use actix_web::ws; use failure::Fail; -use futures::future::Future; -use hashbrown::{hash_map::Entry, HashMap}; +use hashbrown::HashMap; use crate::{ api::client::*, - api::control::member::{ - ControlError, GetMember, Id, Member, MemberRepository, - }, + api::control::member::Id, log::prelude::*, }; #[derive(Fail, Debug, PartialEq)] pub enum ClientError { - #[fail(display = "Session already exists")] + #[fail(display = "Member already connected")] AlreadyExists, } @@ -41,18 +33,18 @@ pub struct WsSessions { } impl Actor for WsSessions { - type Context = ws::WebsocketContext; + type Context = ws::WebsocketContext; /// Method is called on actor start. We start the heartbeat process here. fn started(&mut self, ctx: &mut Self::Context) { self.hb(ctx); - let msg = JoinMember(self.member_id, ctx.address()); - self.issue_async(msg); + let mut session_repo = ctx.state().session_repo.lock().unwrap(); + session_repo.add_session(self.member_id, ctx.address()); } fn stopped(&mut self, ctx: &mut Self::Context) { - let msg = LeaveMember(self.member_id); - self.issue_async(msg); + let mut session_repo = ctx.state().session_repo.lock().unwrap(); + session_repo.remove_session(self.member_id); } } @@ -108,63 +100,25 @@ impl WsSessions { } } -#[derive(Clone, Message)] -pub struct JoinMember(pub Id, pub Addr); - -#[derive(Clone, Message)] -pub struct LeaveMember(pub Id); - -#[derive(Clone, Message)] -#[rtype(result = "bool")] -pub struct IsConnected(pub Id); - -impl Handler for WsSessionRepository { - type Result = MessageResult; - - fn handle( - &mut self, - msg: IsConnected, - _: &mut Self::Context, - ) -> Self::Result { - debug!("IsConnected message received"); - MessageResult(self.sessions.contains_key(&msg.0)) - } -} - type Client = Addr; -#[derive(Default)] +#[derive(Default, Debug)] pub struct WsSessionRepository { sessions: HashMap, } -impl Actor for WsSessionRepository { - type Context = Context; - - fn started(&mut self, ctx: &mut Self::Context) { - self.subscribe_async::(ctx); - self.subscribe_async::(ctx); +impl WsSessionRepository { + pub fn is_connected(&self, member_id: Id) -> bool { + self.sessions.contains_key(&member_id) } -} - -impl Handler for WsSessionRepository { - type Result = (); - fn handle(&mut self, msg: JoinMember, _ctx: &mut Self::Context) { - let JoinMember(id, client) = msg; + pub fn add_session(&mut self, id: Id, client: Client) { self.sessions.insert(id, client); info!("{:?}", self.sessions); } -} - -impl Handler for WsSessionRepository { - type Result = (); - fn handle(&mut self, msg: LeaveMember, _ctx: &mut Self::Context) { - self.sessions.remove(&msg.0); + pub fn remove_session(&mut self, id: Id) { + self.sessions.remove(&id); info!("{:?}", self.sessions); } } - -impl SystemService for WsSessionRepository {} -impl Supervised for WsSessionRepository {} diff --git a/src/main.rs b/src/main.rs index a75108a46..1b0af7128 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,7 @@ use actix::prelude::*; use dotenv::dotenv; -use crate::{ - api::client::*, - api::control::{Member, MemberRepository}, - log::prelude::*, -}; +use crate::api::client::*; #[macro_use] mod utils; From fcb10728d2f09a8f1e0ac4a94f37ca21fcae1d6f Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 30 Jan 2019 13:43:40 +0200 Subject: [PATCH 019/179] Refactoring and simplify WsSessionRepository - impl constructor for WsSessionRepository - rename methods of WsSessionRepository - remove errors --- Cargo.lock | 108 +------------------------------------- Cargo.toml | 3 +- src/api/control/member.rs | 51 +++++++----------- src/api/control/mod.rs | 2 +- src/errors/mod.rs | 13 ----- src/main.rs | 8 +-- 6 files changed, 27 insertions(+), 158 deletions(-) delete mode 100644 src/errors/mod.rs diff --git a/Cargo.lock b/Cargo.lock index a6f8edd65..a83447acf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "arrayvec" version = "0.4.10" @@ -11,28 +13,6 @@ name = "autocfg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "backtrace" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "backtrace-sys" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "bitflags" version = "1.0.4" @@ -43,11 +23,6 @@ name = "byteorder" version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "cc" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cfg-if" version = "0.1.6" @@ -127,26 +102,6 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "failure" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "failure_derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -199,7 +154,6 @@ name = "medea" version = "0.1.0" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -267,22 +221,6 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "proc-macro2" -version = "0.4.25" -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.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "rand" version = "0.6.4" @@ -373,11 +311,6 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "rustc-demangle" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "rustc_version" version = "0.2.3" @@ -473,27 +406,6 @@ name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "syn" -version = "0.15.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (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 = "synstructure" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (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 = "take_mut" version = "0.2.2" @@ -517,11 +429,6 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unreachable" version = "1.0.0" @@ -557,11 +464,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -570,8 +474,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" -"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" -"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "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 hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" @@ -587,8 +489,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "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 proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "d3797b7142c9aa74954e351fc089bbee7958cebbff6bf2815e7ffff0b19f547d" -"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" "checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" @@ -599,7 +499,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" @@ -613,12 +512,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" -"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" diff --git a/Cargo.toml b/Cargo.toml index 2bbdded1f..7281bb4ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,9 +11,8 @@ repository = "https://github.com/instrumentisto/medea" [dependencies] chrono = "0.4" -failure = "0.1" hashbrown = "0.1" -slog = { version = "2.4", features = ["max_level_info", "release_max_level_warn"] } +slog = { version = "2.4", features = ["max_level_debug", "release_max_level_warn"] } slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" diff --git a/src/api/control/member.rs b/src/api/control/member.rs index ca4c94711..108e3093d 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,18 +1,9 @@ //! Member definitions and implementations. -use failure::Fail; use hashbrown::HashMap; use crate::log::prelude::*; -/// Error that can be returned by Control API. -#[derive(Fail, Debug, PartialEq)] -pub enum ControlError { - /// [`Member`] is not found in repository. - #[fail(display = "Not found member")] - NotFound, -} - /// ID of [`Member`]. pub type Id = u64; @@ -26,31 +17,29 @@ pub struct Member { } /// Repository that stores store [`Member`]s. +#[derive(Default)] pub struct MemberRepository { - pub members: HashMap, + members: HashMap, } impl MemberRepository { + /// Creates new [`Member`]s repository with passed-in [`Member`]s. + pub fn new(members: HashMap) -> Self { + MemberRepository { members } + } + /// Returns [`Member`] by its ID. - pub fn get_member(&self, id: Id) -> Result { + pub fn get(&self, id: Id) -> Option<&Member> { debug!("retrieve member by id: {}", id); - self.members - .get(&id) - .map(|member| member.to_owned()) - .ok_or(ControlError::NotFound) + self.members.get(&id) } /// Returns [`Member`] by its credentials. - pub fn get_member_by_credentials( - &self, - credentials: String, - ) -> Result { + pub fn get_by_credentials(&self, credentials: String) -> Option<&Member> { debug!("retrieve member by credentials: {}", credentials); self.members .values() .find(|member| member.credentials.eq(&credentials)) - .map(|member| member.to_owned()) - .ok_or(ControlError::NotFound) } } @@ -69,10 +58,10 @@ mod tests { #[test] fn returns_member_by_id() { let members = members(); - let repo = &MemberRepository { members }; + let repo = MemberRepository::new(members); - let res = repo.get_member(1); - assert!(res.is_ok()); + let res = repo.get(1); + assert!(res.is_some()); let member = res.unwrap(); assert_eq!(member.id, 1); } @@ -80,11 +69,10 @@ mod tests { #[test] fn returns_member_by_credentials() { let members = members(); - let repo = &MemberRepository { members }; + let repo = MemberRepository::new(members); - let res = - repo.get_member_by_credentials("responder_credentials".to_owned()); - assert!(res.is_ok()); + let res = repo.get_by_credentials("responder_credentials".to_owned()); + assert!(res.is_some()); let member = res.unwrap(); assert_eq!(member.id, 2); assert_eq!(member.credentials, "responder_credentials".to_owned()); @@ -93,10 +81,9 @@ mod tests { #[test] fn returns_error_not_found() { let members = members(); - let repo = &MemberRepository { members }; + let repo = MemberRepository::new(members); - let res = repo.get_member(999); - assert!(res.is_err()); - assert_eq!(res.err(), Some(ControlError::NotFound)); + let res = repo.get(999); + assert!(res.is_none()); } } diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs index c20222f72..edcb52719 100644 --- a/src/api/control/mod.rs +++ b/src/api/control/mod.rs @@ -2,4 +2,4 @@ pub mod member; -pub use self::member::{ControlError, Id, Member, MemberRepository}; +pub use self::member::{Id, Member, MemberRepository}; diff --git a/src/errors/mod.rs b/src/errors/mod.rs deleted file mode 100644 index 12dcf5296..000000000 --- a/src/errors/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Common errors used in application. - -use failure::Fail; - -use crate::api::control::ControlError; - -/// Any error that may occur in this application. -#[derive(Fail, Debug)] -pub enum AppError { - /// Error returned from Control API. - #[fail(display = "Not implemented")] - Control(#[fail(cause)] ControlError), -} diff --git a/src/main.rs b/src/main.rs index cafc65439..f0b3fe422 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,9 +6,9 @@ use crate::{ }; mod api; -mod errors; mod log; -#[macro_use] mod utils; +#[macro_use] +mod utils; fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); @@ -19,8 +19,8 @@ fn main() { 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let repo = MemberRepository { members }; - if let Ok(member) = repo.get_member(1) { + let repo = MemberRepository::new(members); + if let Some(member) = repo.get(1) { info!("{:?}", member); info!("Hooray!"); warn!("It works"); From 417459776b4f4e0c9760048dea6c4bceb9f29ec5 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 30 Jan 2019 16:13:39 +0200 Subject: [PATCH 020/179] Add docs --- Cargo.lock | 15 ------- Cargo.toml | 2 - src/api/client/server.rs | 27 +++++------- src/api/client/session.rs | 87 +++++++++++++++++---------------------- src/main.rs | 5 ++- 5 files changed, 51 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58608fc6a..fb37dd83c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,16 +29,6 @@ dependencies = [ "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "actix-broker" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", - "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "actix-net" version = "0.2.6" @@ -684,12 +674,9 @@ name = "medea" version = "0.1.0" dependencies = [ "actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-broker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -697,7 +684,6 @@ dependencies = [ "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1799,7 +1785,6 @@ dependencies = [ [metadata] "checksum actix 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c616db5fa4b0c40702fb75201c2af7f8aa8f3a2e2c1dda3b0655772aa949666" -"checksum actix-broker 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6e35516b71d630755f23fc271db50009ee209f819087c0c1eb5abc10cc4b187b" "checksum actix-net 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8bebfbe6629e0131730746718c9e032b58f02c6ce06ed7c982b9fef6c8545acd" "checksum actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)" = "e9f33c941e5e69a58a6bfef33853228042ed3799fc4b5a4923a36a85776fb690" "checksum actix_derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4300e9431455322ae393d43a2ba1ef96b8080573c0fc23b196219efedfb6ba69" diff --git a/Cargo.toml b/Cargo.toml index f8d8e0a77..13f4812ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,6 @@ actix = "0.7" actix-web = "0.7" chrono = "0.4" dotenv = "0.13" -futures = "0.1" hashbrown = "0.1" slog = "2.4" slog-envlogger = "2.1" @@ -22,4 +21,3 @@ slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" -tokio = "0.1" diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 5359b9d3b..c2a967029 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -1,3 +1,5 @@ +//! Implementation HTTP server for handle websocket connections. + use std::sync::{Arc, Mutex}; use actix_web::{ @@ -6,19 +8,19 @@ use actix_web::{ }; use crate::{ - api::client::*, - api::control::member::{ControlError, Member, MemberRepository}, + api::client::session::{WsSessionRepository, WsSessions}, + api::control::member::{Member, MemberRepository}, log::prelude::*, }; -/// do websocket handshake and start `WsSessions` actor +/// Do websocket handshake and start `WsSessions` actor fn ws_index( (r, creds, state): (HttpRequest, Path, State), ) -> Result { - info!("{:?}", creds); let member_repo = state.members_repo.lock().unwrap(); - match member_repo.get_member_by_credentials(creds.into_inner()) { - Ok(member) => { + match member_repo.get_by_credentials(creds.into_inner()) { + None => Ok(HttpResponse::NotFound().finish()), + Some(member) => { let session_repo = state.session_repo.lock().unwrap(); if session_repo.is_connected(member.id) { Ok(HttpResponse::Conflict().finish()) @@ -26,18 +28,10 @@ fn ws_index( ws::start(&r, WsSessions::new(member.id)) } } - Err(e) => match e { - ControlError::NotFound => Ok(HttpResponse::NotFound().finish()), - _ => Ok(HttpResponse::InternalServerError().finish()), - }, } } -fn index(_r: &HttpRequest) -> Result { - Ok(HttpResponse::Ok().finish()) -} - -/// State with repository address +/// State with repositories addresses pub struct AppState { pub members_repo: Arc>, pub session_repo: Arc>, @@ -49,7 +43,7 @@ pub fn run() { 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let members_repo = Arc::new(Mutex::new(MemberRepository { members })); + let members_repo = Arc::new(Mutex::new(MemberRepository::new(members))); let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); server::new(move || { @@ -61,7 +55,6 @@ pub fn run() { .resource("/ws/{credentials}", |r| { r.method(http::Method::GET).with(ws_index) }) - .resource("/", |r| r.method(http::Method::GET).f(index)) }) .bind("127.0.0.1:8080") .unwrap() diff --git a/src/api/client/session.rs b/src/api/client/session.rs index b21723425..0fbe865c7 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,29 +1,20 @@ +//! Member websocket session definitions and implementations. + use std::time::{Duration, Instant}; use actix::prelude::*; use actix_web::ws; -use failure::Fail; use hashbrown::HashMap; -use crate::{ - api::client::*, - api::control::member::Id, - log::prelude::*, -}; - -#[derive(Fail, Debug, PartialEq)] -pub enum ClientError { - #[fail(display = "Member already connected")] - AlreadyExists, -} +use crate::{api::client::AppState, api::control::member::Id, log::prelude::*}; /// How often heartbeat pings are sent const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); /// How long before lack of client response causes a timeout const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); -/// websocket connection is long running connection, it easier -/// to handle with an actor +/// Websocket connection is long running connection, it easier +/// to handle with an actor. #[derive(Debug)] pub struct WsSessions { /// Client must send ping at least once per 10 seconds (CLIENT_TIMEOUT), @@ -32,16 +23,41 @@ pub struct WsSessions { member_id: Id, } +impl WsSessions { + /// Creates new [`Member`] session with passed-in [`Member`] ID. + pub fn new(member_id: Id) -> Self { + Self { + hb: Instant::now(), + member_id, + } + } + + /// Helper method that sends ping to client every second. + /// + /// Also this method checks heartbeats from client + fn hb(&self, ctx: &mut ::Context) { + ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { + if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { + ctx.stop(); + return; + } + ctx.ping(""); + }); + } +} + impl Actor for WsSessions { type Context = ws::WebsocketContext; - /// Method is called on actor start. We start the heartbeat process here. + /// Start the heartbeat process and store session in repository + /// on start [`Member`] session. fn started(&mut self, ctx: &mut Self::Context) { self.hb(ctx); let mut session_repo = ctx.state().session_repo.lock().unwrap(); session_repo.add_session(self.member_id, ctx.address()); } + /// Remove [`Member`] session repository after stopped session. fn stopped(&mut self, ctx: &mut Self::Context) { let mut session_repo = ctx.state().session_repo.lock().unwrap(); session_repo.remove_session(self.member_id); @@ -51,8 +67,6 @@ impl Actor for WsSessions { /// Handler for `ws::Message` impl StreamHandler for WsSessions { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { - // process websocket messages - println!("WS: {:?}", msg); match msg { ws::Message::Ping(msg) => { self.hb = Instant::now(); @@ -70,55 +84,30 @@ impl StreamHandler for WsSessions { } } -impl WsSessions { - pub fn new(member_id: Id) -> Self { - Self { - hb: Instant::now(), - member_id, - } - } - - /// helper method that sends ping to client every second. - /// - /// also this method checks heartbeats from client - fn hb(&self, ctx: &mut ::Context) { - ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { - // check client heartbeats - if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { - // heartbeat timed out - println!("Websocket Client heartbeat failed, disconnecting!"); - - // stop actor - ctx.stop(); - - // don't try to send a ping - return; - } - - ctx.ping(""); - }); - } -} - +/// Address of [`Member`] session for communicate with it. type Client = Addr; +/// Repository that stores [`Member`] sessions. #[derive(Default, Debug)] pub struct WsSessionRepository { sessions: HashMap, } impl WsSessionRepository { + /// Returns `true` if member with given ID is connected at moment. pub fn is_connected(&self, member_id: Id) -> bool { self.sessions.contains_key(&member_id) } + /// Stores address of [`Member`] session in repository. pub fn add_session(&mut self, id: Id, client: Client) { + debug!("add session for member: {}", id); self.sessions.insert(id, client); - info!("{:?}", self.sessions); } + /// Removes address of [`Member`] session in repository. pub fn remove_session(&mut self, id: Id) { + debug!("remove session for member: {}", id); self.sessions.remove(&id); - info!("{:?}", self.sessions); } } diff --git a/src/main.rs b/src/main.rs index 8d1326851..0cf7b3036 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,11 +5,12 @@ use dotenv::dotenv; use crate::api::client::*; -mod api; -mod log; #[macro_use] mod utils; +mod api; +mod log; + fn main() { dotenv().ok(); let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); From 1ab77fe28a78a09d420208a9bc00f92d7b5bf9fe Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 31 Jan 2019 10:18:03 +0200 Subject: [PATCH 021/179] Returns cloned member from repo --- src/api/control/member.rs | 9 +++++---- src/main.rs | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 108e3093d..00365b42a 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -16,7 +16,7 @@ pub struct Member { pub credentials: String, } -/// Repository that stores store [`Member`]s. +/// Repository that stores [`Member`]s. #[derive(Default)] pub struct MemberRepository { members: HashMap, @@ -29,17 +29,18 @@ impl MemberRepository { } /// Returns [`Member`] by its ID. - pub fn get(&self, id: Id) -> Option<&Member> { + pub fn get(&self, id: Id) -> Option { debug!("retrieve member by id: {}", id); - self.members.get(&id) + self.members.get(&id).map(|member| member.clone()) } /// Returns [`Member`] by its credentials. - pub fn get_by_credentials(&self, credentials: String) -> Option<&Member> { + pub fn get_by_credentials(&self, credentials: String) -> Option { debug!("retrieve member by credentials: {}", credentials); self.members .values() .find(|member| member.credentials.eq(&credentials)) + .map(|member| member.clone()) } } diff --git a/src/main.rs b/src/main.rs index f0b3fe422..a95242186 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,11 +5,12 @@ use crate::{ log::prelude::*, }; -mod api; -mod log; #[macro_use] mod utils; +mod api; +mod log; + fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); let _scope_guard = slog_scope::set_global_logger(logger); From 75b48cc5e98d3600ec57d19740de4c7a5060a8fd Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 31 Jan 2019 14:19:10 +0200 Subject: [PATCH 022/179] Some fix --- src/api/client/server.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/client/server.rs b/src/api/client/server.rs index c2a967029..477ab8dfe 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -18,7 +18,7 @@ fn ws_index( (r, creds, state): (HttpRequest, Path, State), ) -> Result { let member_repo = state.members_repo.lock().unwrap(); - match member_repo.get_by_credentials(creds.into_inner()) { + match member_repo.get_by_credentials(creds.as_str()) { None => Ok(HttpResponse::NotFound().finish()), Some(member) => { let session_repo = state.session_repo.lock().unwrap(); From f669e414f9ca2faf0026c31cc0bf1aab7772669a Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 31 Jan 2019 15:10:43 +0200 Subject: [PATCH 023/179] Add dependencies --- Cargo.lock | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 + 2 files changed, 172 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index a83447acf..44bc06b3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,13 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "aho-corasick" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arrayvec" version = "0.4.10" @@ -46,6 +54,21 @@ dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "config" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "crossbeam" version = "0.6.0" @@ -130,6 +153,11 @@ name = "itoa" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "lazy_static" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lazy_static" version = "1.2.0" @@ -140,6 +168,20 @@ name = "libc" version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "linked-hash-map" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "linked-hash-map" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "lock_api" version = "0.1.5" @@ -154,11 +196,22 @@ name = "medea" version = "0.1.0" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "config 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memchr" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -171,6 +224,15 @@ name = "nodrop" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "nom" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-integer" version = "0.1.39" @@ -179,6 +241,14 @@ dependencies = [ "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "num-traits" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "num-traits" version = "0.2.6" @@ -311,6 +381,31 @@ name = "redox_syscall" version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "regex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "regex-syntax" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rust-ini" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc_version" version = "0.2.3" @@ -342,11 +437,28 @@ name = "semver-parser" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "serde" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "serde-hjson" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "serde_json" version = "1.0.36" @@ -357,6 +469,14 @@ dependencies = [ "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_test" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "slog" version = "2.4.1" @@ -429,6 +549,19 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "toml" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ucd-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unreachable" version = "1.0.0" @@ -437,6 +570,16 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "utf8-ranges" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "void" version = "1.0.2" @@ -461,7 +604,16 @@ name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "yaml-rust" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [metadata] +"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" @@ -469,6 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum config 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e82d07fac0a5eeaa9d959b5194d01bb66e414665f547416958d2b430f8f4852" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" "checksum crossbeam-channel 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "137bc235f622ffaa0428e3854e24acb53291fc0b3ff6fb2cb75a8be6fb02f06b" "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" @@ -478,12 +631,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" +"checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" +"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" +"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" +"checksum nom 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b30adc557058ce00c9d0d7cb3c6e0b5bc6f36e2e2eabe74b0ba726d194abd588" "checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" +"checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" @@ -499,13 +658,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.50 (registry+https://github.com/rust-lang/crates.io-index)" = "52ee9a534dc1301776eff45b4fa92d2c39b1d8c3d3357e6eb593e0d795506fc2" +"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" +"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" +"checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "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 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" +"checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" +"checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" @@ -515,8 +680,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" +"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "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" +"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e" diff --git a/Cargo.toml b/Cargo.toml index 7281bb4ae..586d3c153 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,9 +10,11 @@ readme = "README.md" repository = "https://github.com/instrumentisto/medea" [dependencies] +config = "0.9" chrono = "0.4" hashbrown = "0.1" slog = { version = "2.4", features = ["max_level_debug", "release_max_level_warn"] } slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" +toml = "0.4" From 1852bad9af222da60e311677be73bfd8381514bb Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 4 Feb 2019 15:20:30 +0200 Subject: [PATCH 024/179] Remove checking old connection of member --- src/api/client/server.rs | 17 ++--------------- src/api/client/session.rs | 5 ----- src/main.rs | 11 ++++++++++- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 477ab8dfe..78c6be818 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -19,15 +19,8 @@ fn ws_index( ) -> Result { let member_repo = state.members_repo.lock().unwrap(); match member_repo.get_by_credentials(creds.as_str()) { + Some(member) => ws::start(&r, WsSessions::new(member.id)), None => Ok(HttpResponse::NotFound().finish()), - Some(member) => { - let session_repo = state.session_repo.lock().unwrap(); - if session_repo.is_connected(member.id) { - Ok(HttpResponse::Conflict().finish()) - } else { - ws::start(&r, WsSessions::new(member.id)) - } - } } } @@ -37,13 +30,7 @@ pub struct AppState { pub session_repo: Arc>, } -pub fn run() { - let members = hashmap! { - 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, - }; - - let members_repo = Arc::new(Mutex::new(MemberRepository::new(members))); +pub fn run(members_repo: Arc>) { let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); server::new(move || { diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 0fbe865c7..4e6e766d0 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -94,11 +94,6 @@ pub struct WsSessionRepository { } impl WsSessionRepository { - /// Returns `true` if member with given ID is connected at moment. - pub fn is_connected(&self, member_id: Id) -> bool { - self.sessions.contains_key(&member_id) - } - /// Stores address of [`Member`] session in repository. pub fn add_session(&mut self, id: Id, client: Client) { debug!("add session for member: {}", id); diff --git a/src/main.rs b/src/main.rs index 0cf7b3036..f09e222f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,11 @@ //! Medea media server application. +use std::sync::{Arc, Mutex}; use actix::prelude::*; use dotenv::dotenv; use crate::api::client::*; +use crate::api::control::*; #[macro_use] mod utils; @@ -17,7 +19,14 @@ fn main() { let _scope_guard = slog_scope::set_global_logger(logger); let _guard = slog_stdlog::init().unwrap(); + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + + let members_repo = Arc::new(Mutex::new(MemberRepository::new(members))); + let sys = System::new("medea"); - server::run(); + server::run(members_repo); let _ = sys.run(); } From 1a3caca35b7c413dc9af1a67e2fcb04d594a21d4 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 5 Feb 2019 11:41:59 +0200 Subject: [PATCH 025/179] Impl test for handler ws connection --- Cargo.lock | 1 + Cargo.toml | 1 + src/api/client/server.rs | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index fb37dd83c..b7c5f4b7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,6 +677,7 @@ dependencies = [ "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 13f4812ff..f4f4c538a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ actix = "0.7" actix-web = "0.7" chrono = "0.4" dotenv = "0.13" +futures = "0.1" hashbrown = "0.1" slog = "2.4" slog-envlogger = "2.1" diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 78c6be818..350592e3e 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -49,3 +49,42 @@ pub fn run(members_repo: Arc>) { info!("Started http server: 127.0.0.1:8080"); } + +#[cfg(test)] +mod tests { + use super::*; + use actix_web::test; + use futures::stream::Stream; + use hashbrown::HashMap; + + use crate::api::control::*; + + fn test_members() -> HashMap { + hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + } + } + + #[test] + fn connect_by_credentials() { + let members_repo = + Arc::new(Mutex::new(MemberRepository::new(test_members()))); + let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); + + let mut srv = test::TestServer::with_factory(move || { + App::with_state(AppState { + members_repo: members_repo.clone(), + session_repo: session_repo.clone(), + }) + .resource("/ws/{credentials}", |r| { + r.method(http::Method::GET).with(ws_index) + }) + }); + let (reader, mut writer) = srv.ws_at("/ws/caller_credentials").unwrap(); + + writer.text("text"); + let (item, reader) = srv.execute(reader.into_future()).unwrap(); + assert_eq!(item, Some(ws::Message::Text("text".to_owned()))); + } +} From 7cfc1eba5dbe926178f5be8811152e6785d1b6e8 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 6 Feb 2019 11:16:14 +0200 Subject: [PATCH 026/179] Impl handle event --- Cargo.lock | 14 ++++ Cargo.toml | 3 + src/api/client/server.rs | 41 +---------- src/api/client/session.rs | 140 +++++++++++++++++++++++++++++++------- src/api/control/member.rs | 1 + src/log/mod.rs | 1 + 6 files changed, 135 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7c5f4b7f..2423474af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -679,6 +679,9 @@ dependencies = [ "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1142,6 +1145,16 @@ name = "serde" version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "serde_derive" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "serde_json" version = "1.0.36" @@ -1912,6 +1925,7 @@ dependencies = [ "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.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" +"checksum serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)" = "633e97856567e518b59ffb2ad7c7a4fd4c5d91d9c7f32dd38a27b2bf7e8114ea" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" "checksum serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d48f9f99cd749a2de71d29da5f948de7f2764cc5a9d7f3c97e3514d4ee6eabf2" "checksum sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" diff --git a/Cargo.toml b/Cargo.toml index f4f4c538a..f35e5f56f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,9 @@ chrono = "0.4" dotenv = "0.13" futures = "0.1" hashbrown = "0.1" +serde = "1.0" +serde_derive = "1.0" +serde_json = "1.0" slog = "2.4" slog-envlogger = "2.1" slog-stdlog = "3.0" diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 350592e3e..b97ed3a63 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -9,7 +9,7 @@ use actix_web::{ use crate::{ api::client::session::{WsSessionRepository, WsSessions}, - api::control::member::{Member, MemberRepository}, + api::control::member::MemberRepository, log::prelude::*, }; @@ -49,42 +49,3 @@ pub fn run(members_repo: Arc>) { info!("Started http server: 127.0.0.1:8080"); } - -#[cfg(test)] -mod tests { - use super::*; - use actix_web::test; - use futures::stream::Stream; - use hashbrown::HashMap; - - use crate::api::control::*; - - fn test_members() -> HashMap { - hashmap! { - 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, - } - } - - #[test] - fn connect_by_credentials() { - let members_repo = - Arc::new(Mutex::new(MemberRepository::new(test_members()))); - let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); - - let mut srv = test::TestServer::with_factory(move || { - App::with_state(AppState { - members_repo: members_repo.clone(), - session_repo: session_repo.clone(), - }) - .resource("/ws/{credentials}", |r| { - r.method(http::Method::GET).with(ws_index) - }) - }); - let (reader, mut writer) = srv.ws_at("/ws/caller_credentials").unwrap(); - - writer.text("text"); - let (item, reader) = srv.execute(reader.into_future()).unwrap(); - assert_eq!(item, Some(ws::Message::Text("text".to_owned()))); - } -} diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 4e6e766d0..0512f54cc 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,48 +1,59 @@ //! Member websocket session definitions and implementations. -use std::time::{Duration, Instant}; +use std::time::Duration; use actix::prelude::*; use actix_web::ws; use hashbrown::HashMap; +use serde_derive::{Deserialize, Serialize}; use crate::{api::client::AppState, api::control::member::Id, log::prelude::*}; -/// How often heartbeat pings are sent -const HEARTBEAT_INTERVAL: Duration = Duration::from_secs(5); -/// How long before lack of client response causes a timeout -const CLIENT_TIMEOUT: Duration = Duration::from_secs(10); +/// How long before lack of client message causes a timeout. +const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); + +#[derive(Debug, Message, Deserialize)] +enum Event { + #[serde(rename = "ping")] + Ping(usize), +} + +#[derive(Debug, Serialize)] +enum Command { + #[serde(rename = "pong")] + Pong(usize), +} /// Websocket connection is long running connection, it easier /// to handle with an actor. #[derive(Debug)] pub struct WsSessions { - /// Client must send ping at least once per 10 seconds (CLIENT_TIMEOUT), - /// otherwise we drop connection. - hb: Instant, member_id: Id, + /// Client must send any text message at least once per 10 seconds + /// (CLIENT_IDLE_TIMEOUT), otherwise we drop connection. + idle_timeout_handler: Option, } impl WsSessions { /// Creates new [`Member`] session with passed-in [`Member`] ID. pub fn new(member_id: Id) -> Self { Self { - hb: Instant::now(), member_id, + idle_timeout_handler: None, } } /// Helper method that sends ping to client every second. /// /// Also this method checks heartbeats from client - fn hb(&self, ctx: &mut ::Context) { - ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { - if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { + fn hb(&mut self, ctx: &mut ::Context) { + if let Some(handler) = self.idle_timeout_handler { + ctx.cancel_future(handler); + } + self.idle_timeout_handler = + Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |_, ctx| { ctx.stop(); - return; - } - ctx.ping(""); - }); + })); } } @@ -64,22 +75,38 @@ impl Actor for WsSessions { } } +impl Handler for WsSessions { + type Result = (); + + fn handle(&mut self, event: Event, ctx: &mut Self::Context) { + match event { + Event::Ping(n) => { + ctx.text(serde_json::to_string(&Command::Pong(n)).unwrap()) + } + }; + } +} + /// Handler for `ws::Message` impl StreamHandler for WsSessions { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { - ws::Message::Ping(msg) => { - self.hb = Instant::now(); - ctx.pong(&msg); + ws::Message::Text(text) => { + match serde_json::from_str::(&text) { + Ok(event) => { + println!("Received status:\n{:?}\n", event); + ctx.notify(event); + self.hb(ctx); + } + Err(e) => { + ctx.text(format!("Could not parse event: {}\n", e)); + } + } } - ws::Message::Pong(_) => { - self.hb = Instant::now(); - } - ws::Message::Text(text) => ctx.text(text), - ws::Message::Binary(bin) => ctx.binary(bin), - ws::Message::Close(_) => { + ws::Message::Binary(_) | ws::Message::Close(_) => { ctx.stop(); } + _ => (), } } } @@ -106,3 +133,66 @@ impl WsSessionRepository { self.sessions.remove(&id); } } + +#[cfg(test)] +mod tests { + use std::sync::{Arc, Mutex}; + use std::{thread, time}; + + use actix_web::{error, http, test, App}; + use futures::stream::Stream; + + use super::*; + use crate::api::control::*; + + #[test] + fn connect_by_credentials() { + let members_repo = Arc::new(Mutex::new(MemberRepository::default())); + let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); + + let mut srv = test::TestServer::with_factory(move || { + App::with_state(AppState { + members_repo: members_repo.clone(), + session_repo: session_repo.clone(), + }) + .resource("/ws/", |r| { + r.method(http::Method::GET) + .with(|r| ws::start(&r, WsSessions::new(1))) + }) + }); + let (reader, mut writer) = srv.ws_at("/ws/").unwrap(); + + writer.text(r#"{"ping":33}"#); + let (item, _reader) = srv.execute(reader.into_future()).unwrap(); + assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); + } + + #[test] + fn disconnect_by_timeout() { + let members_repo = Arc::new(Mutex::new(MemberRepository::default())); + let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); + + let mut srv = test::TestServer::with_factory(move || { + App::with_state(AppState { + members_repo: members_repo.clone(), + session_repo: session_repo.clone(), + }) + .resource("/ws/{credentials}", |r| { + r.method(http::Method::GET) + .with(|r| ws::start(&r, WsSessions::new(1))) + }) + }); + let (reader, mut writer) = srv.ws_at("/ws/caller_credentials").unwrap(); + + thread::sleep(CLIENT_IDLE_TIMEOUT); + + writer.text(r#"{"ping":33}"#); + assert!(match srv.execute(reader.into_future()) { + Err(( + ws::ProtocolError::Payload(error::PayloadError::Io(_)), + _, + )) => true, + _ => false, + }); + } +} diff --git a/src/api/control/member.rs b/src/api/control/member.rs index 162ab45b3..d566502dc 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -29,6 +29,7 @@ impl MemberRepository { } /// Returns [`Member`] by its ID. + #[allow(dead_code)] pub fn get(&self, id: Id) -> Option { debug!("retrieve member by id: {}", id); self.members.get(&id).map(|member| member.clone()) diff --git a/src/log/mod.rs b/src/log/mod.rs index a9b8d4c6b..82aaeaf4c 100644 --- a/src/log/mod.rs +++ b/src/log/mod.rs @@ -37,6 +37,7 @@ where /// /// Created [`Logger`] produces log records with `lvl`, `time` and `msg` fields /// by default. +#[allow(dead_code)] pub fn new_logger(w: W) -> Logger where W: io::Write + Send + 'static, From 330128465e6a76c5d0fa712969074bd939ccee11 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 6 Feb 2019 15:37:29 +0200 Subject: [PATCH 027/179] Impl settings --- Cargo.lock | 133 +++++++++++++++++++++++++++++++++++++++ Cargo.toml | 6 ++ config.toml | 0 src/main.rs | 10 +++ src/settings/duration.rs | 53 ++++++++++++++++ src/settings/mod.rs | 25 ++++++++ src/settings/server.rs | 20 ++++++ 7 files changed, 247 insertions(+) create mode 100644 config.toml create mode 100644 src/settings/duration.rs create mode 100644 src/settings/mod.rs create mode 100644 src/settings/server.rs diff --git a/Cargo.lock b/Cargo.lock index 44bc06b3f..4b5b609c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,6 +21,28 @@ name = "autocfg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "backtrace" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "bitflags" version = "1.0.4" @@ -31,6 +53,11 @@ name = "byteorder" version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "cc" +version = "1.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.6" @@ -125,6 +152,36 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dotenv" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", + "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "failure_derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -197,7 +254,13 @@ version = "0.1.0" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -291,6 +354,22 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "0.4.27" +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.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand" version = "0.6.4" @@ -406,6 +485,11 @@ name = "rust-ini" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rustc-demangle" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "rustc_version" version = "0.2.3" @@ -459,6 +543,16 @@ dependencies = [ "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "serde_derive" +version = "1.0.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "serde_json" version = "1.0.36" @@ -526,6 +620,27 @@ name = "stable_deref_trait" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "syn" +version = "0.15.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (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 = "synstructure" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.26 (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 = "take_mut" version = "0.2.2" @@ -562,6 +677,11 @@ name = "ucd-util" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unreachable" version = "1.0.0" @@ -616,8 +736,11 @@ dependencies = [ "checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" +"checksum backtrace 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "b5b493b66e03090ebc4343eb02f94ff944e0cbc9ac6571491d170ba026741eb5" +"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum cc 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4390a3b5f4f6bce9c1d0c00128379df433e53777fdd30e92f16a529332baec4e" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -627,6 +750,9 @@ dependencies = [ "checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13" "checksum crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f10a4f8f409aaac4b16a5474fb233624238fcdeefb9ba50d5ea059aab63ba31c" "checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" +"checksum dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0d0a1279c96732bc6800ce6337b6a614697b0e74ae058dc03c62ebeb78b4d86" +"checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" +"checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "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 hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" @@ -648,6 +774,8 @@ dependencies = [ "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 proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" +"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" "checksum rand 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3906503e80ac6cbcacb2c2973fa8e473f24d7e2747c8c92bb230c2441cad96b5" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" "checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" @@ -661,6 +789,7 @@ dependencies = [ "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" +"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" @@ -669,6 +798,7 @@ dependencies = [ "checksum serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" "checksum serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)" = "0e732ed5a5592c17d961555e3b552985baf98d50ce418b7b655f31f6ba7eb1b7" "checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153" +"checksum serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)" = "633e97856567e518b59ffb2ad7c7a4fd4c5d91d9c7f32dd38a27b2bf7e8114ea" "checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" "checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" @@ -677,11 +807,14 @@ dependencies = [ "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" +"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" diff --git a/Cargo.toml b/Cargo.toml index 586d3c153..159bfe39a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,13 @@ repository = "https://github.com/instrumentisto/medea" [dependencies] config = "0.9" chrono = "0.4" +dotenv = "0.13" +failure = "0.1" hashbrown = "0.1" +lazy_static = "1.2" +regex = "1" +serde = "1" +serde_derive = "1" slog = { version = "2.4", features = ["max_level_debug", "release_max_level_warn"] } slog-async = "2.3" slog-json = "2.3" diff --git a/config.toml b/config.toml new file mode 100644 index 000000000..e69de29bb diff --git a/src/main.rs b/src/main.rs index 2a30589d0..5532e126b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,11 @@ //! Medea media server application. +use dotenv::dotenv; + use crate::{ api::control::{Member, MemberRepository}, log::prelude::*, + settings::Settings, }; #[macro_use] @@ -10,8 +13,10 @@ mod utils; mod api; mod log; +mod settings; fn main() { + dotenv().ok(); let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); let _scope_guard = slog_scope::set_global_logger(logger); @@ -24,4 +29,9 @@ fn main() { info!("Hooray!"); warn!("It works"); } + + match Settings::new() { + Ok(settings) => info!("{:?}", settings), + Err(e) => error!("settings error: {}", e), + } } diff --git a/src/settings/duration.rs b/src/settings/duration.rs new file mode 100644 index 000000000..c0a23862d --- /dev/null +++ b/src/settings/duration.rs @@ -0,0 +1,53 @@ +use std::fmt; +use std::time::Duration; + +use lazy_static::*; +use regex::Regex; +use serde::de::{self, Unexpected}; +use serde::Serializer; + +lazy_static! { + static ref REGEX_DURATION: Regex = + Regex::new(r"^(?P\d+)m|(?P\d+)s$").unwrap(); +} + +struct DurationFromStringVisitor; + +pub fn deserialize<'de, D>(d: D) -> Result +where + D: de::Deserializer<'de>, +{ + Ok(d.deserialize_str(DurationFromStringVisitor)?) +} + +impl<'de> de::Visitor<'de> for DurationFromStringVisitor { + type Value = Duration; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!(formatter, "a string representation of duration") + } + + fn visit_str(self, value: &str) -> Result + where + E: de::Error, + { + let caps = REGEX_DURATION + .captures(value) + .ok_or(de::Error::invalid_value(Unexpected::Str(value), &self))?; + let m = caps + .name("minutes") + .map_or(0, |s| s.as_str().parse::().unwrap()); + let s = caps + .name("seconds") + .map_or(0, |s| s.as_str().parse::().unwrap()); + + Ok(Duration::from_secs(m * 60 + s)) + } +} + +pub fn serialize(d: &Duration, s: S) -> Result +where + S: Serializer, +{ + s.serialize_str(format!("{}s", d.as_secs()).as_str()) +} diff --git a/src/settings/mod.rs b/src/settings/mod.rs new file mode 100644 index 000000000..5810a1cdb --- /dev/null +++ b/src/settings/mod.rs @@ -0,0 +1,25 @@ +use config::{Config, Environment, File, FileFormat}; +use failure::Error; +use serde_derive::{Deserialize, Serialize}; +use toml::to_string; + +mod duration; +mod server; + +#[derive(Debug, Default, Deserialize, Serialize)] +pub struct Settings { + server: server::Server, +} + +impl Settings { + pub fn new() -> Result { + let mut cfg = Config::new(); + let defaults = to_string(&Settings::default())?; + cfg.merge(File::from_str(defaults.as_str(), FileFormat::Toml))?; + cfg.merge(File::with_name("config"))?; + cfg.merge(Environment::with_prefix("conf").separator("__"))?; + + let s: Settings = cfg.try_into()?; + Ok(s) + } +} diff --git a/src/settings/server.rs b/src/settings/server.rs new file mode 100644 index 000000000..0826c64fd --- /dev/null +++ b/src/settings/server.rs @@ -0,0 +1,20 @@ +use std::time::Duration; + +use serde_derive::{Deserialize, Serialize}; + +use crate::settings::duration; + +#[derive(Debug, Deserialize, Serialize)] +pub struct Server { + #[serde(serialize_with = "duration::serialize")] + #[serde(deserialize_with = "duration::deserialize")] + client_idle_timeout: Duration, +} + +impl Default for Server { + fn default() -> Server { + Server { + client_idle_timeout: Duration::from_secs(10), + } + } +} From 50adeadb61a27a70b82b41b783c948a46d9dddd1 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 6 Feb 2019 17:11:44 +0200 Subject: [PATCH 028/179] Impl handle Command::Close --- src/api/client/commands.rs | 12 +++++++ src/api/client/events.rs | 8 +++++ src/api/client/mod.rs | 4 ++- src/api/client/session.rs | 71 +++++++++++++++++++------------------- 4 files changed, 58 insertions(+), 37 deletions(-) create mode 100644 src/api/client/commands.rs create mode 100644 src/api/client/events.rs diff --git a/src/api/client/commands.rs b/src/api/client/commands.rs new file mode 100644 index 000000000..ba046aa4f --- /dev/null +++ b/src/api/client/commands.rs @@ -0,0 +1,12 @@ +use actix::Message; +use actix_web::ws::CloseReason; +use serde_derive::Deserialize; + +/// Command is WebSocket messages sent by [`Web Client`] to [`Media Server`]. +#[derive(Debug, Message, Deserialize)] +pub enum Command { + #[serde(rename = "ping")] + Ping(usize), + #[serde(rename = "close")] + Close(Option), +} diff --git a/src/api/client/events.rs b/src/api/client/events.rs new file mode 100644 index 000000000..25736b0e7 --- /dev/null +++ b/src/api/client/events.rs @@ -0,0 +1,8 @@ +use serde_derive::Serialize; + +/// Event is WebSocket messages sent by [`Media Server`] to [`Web Client`]. +#[derive(Debug, Serialize)] +pub enum Event { + #[serde(rename = "pong")] + Pong(usize), +} diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 72e5481c4..baed28332 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,4 +1,6 @@ +pub mod commands; +pub mod events; pub mod server; pub mod session; -pub use self::{server::*, session::*}; +pub use self::{commands::Command, events::Event, server::*, session::*}; diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 0512f54cc..5201422ef 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -5,25 +5,16 @@ use std::time::Duration; use actix::prelude::*; use actix_web::ws; use hashbrown::HashMap; -use serde_derive::{Deserialize, Serialize}; -use crate::{api::client::AppState, api::control::member::Id, log::prelude::*}; +use crate::{ + api::client::{AppState, Command, Event}, + api::control::member::Id, + log::prelude::*, +}; /// How long before lack of client message causes a timeout. const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); -#[derive(Debug, Message, Deserialize)] -enum Event { - #[serde(rename = "ping")] - Ping(usize), -} - -#[derive(Debug, Serialize)] -enum Command { - #[serde(rename = "pong")] - Pong(usize), -} - /// Websocket connection is long running connection, it easier /// to handle with an actor. #[derive(Debug)] @@ -43,16 +34,15 @@ impl WsSessions { } } - /// Helper method that sends ping to client every second. - /// - /// Also this method checks heartbeats from client + /// Helper method that update read timeout handler after every message + /// from [`Web Client`]. fn hb(&mut self, ctx: &mut ::Context) { if let Some(handler) = self.idle_timeout_handler { ctx.cancel_future(handler); } self.idle_timeout_handler = Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |_, ctx| { - ctx.stop(); + ctx.notify(Command::Close(Some(ws::CloseCode::Away.into()))); })); } } @@ -63,9 +53,14 @@ impl Actor for WsSessions { /// Start the heartbeat process and store session in repository /// on start [`Member`] session. fn started(&mut self, ctx: &mut Self::Context) { + let mut session_repo: WsSessionRepository = + ctx.state().session_repo.lock().unwrap(); + if let Some(old) = + session_repo.add_session(self.member_id, ctx.address()) + { + old.send(Command::Close(None)); + } self.hb(ctx); - let mut session_repo = ctx.state().session_repo.lock().unwrap(); - session_repo.add_session(self.member_id, ctx.address()); } /// Remove [`Member`] session repository after stopped session. @@ -75,13 +70,18 @@ impl Actor for WsSessions { } } -impl Handler for WsSessions { +/// Handler for `Command`. +impl Handler for WsSessions { type Result = (); - fn handle(&mut self, event: Event, ctx: &mut Self::Context) { - match event { - Event::Ping(n) => { - ctx.text(serde_json::to_string(&Command::Pong(n)).unwrap()) + fn handle(&mut self, command: Command, ctx: &mut Self::Context) { + match command { + Command::Ping(n) => { + ctx.text(serde_json::to_string(&Event::Pong(n)).unwrap()) + } + Command::Close(reason) => { + ctx.close(reason); + ctx.stop(); } }; } @@ -92,20 +92,19 @@ impl StreamHandler for WsSessions { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { ws::Message::Text(text) => { - match serde_json::from_str::(&text) { - Ok(event) => { - println!("Received status:\n{:?}\n", event); - ctx.notify(event); + match serde_json::from_str::(&text) { + Ok(command) => { + println!("Received command:\n{:?}\n", command); + ctx.notify(command); self.hb(ctx); } Err(e) => { - ctx.text(format!("Could not parse event: {}\n", e)); + ctx.text(format!("Could not parse command: {}\n", e)); } } } - ws::Message::Binary(_) | ws::Message::Close(_) => { - ctx.stop(); - } + ws::Message::Binary(_) => ctx.notify(Command::Close(None)), + ws::Message::Close(reason) => ctx.notify(Command::Close(reason)), _ => (), } } @@ -122,9 +121,9 @@ pub struct WsSessionRepository { impl WsSessionRepository { /// Stores address of [`Member`] session in repository. - pub fn add_session(&mut self, id: Id, client: Client) { + pub fn add_session(&mut self, id: Id, client: Client) -> Option { debug!("add session for member: {}", id); - self.sessions.insert(id, client); + self.sessions.insert(id, client) } /// Removes address of [`Member`] session in repository. @@ -137,7 +136,7 @@ impl WsSessionRepository { #[cfg(test)] mod tests { use std::sync::{Arc, Mutex}; - use std::{thread, time}; + use std::thread; use actix_web::{error, http, test, App}; use futures::stream::Stream; From 7b84926fb3a3d2f1bf9e62de4370edec568f3b48 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 7 Feb 2019 12:06:37 +0200 Subject: [PATCH 029/179] Impl close message --- src/api/client/commands.rs | 3 --- src/api/client/session.rs | 38 ++++++++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/api/client/commands.rs b/src/api/client/commands.rs index ba046aa4f..e0cf10a7f 100644 --- a/src/api/client/commands.rs +++ b/src/api/client/commands.rs @@ -1,5 +1,4 @@ use actix::Message; -use actix_web::ws::CloseReason; use serde_derive::Deserialize; /// Command is WebSocket messages sent by [`Web Client`] to [`Media Server`]. @@ -7,6 +6,4 @@ use serde_derive::Deserialize; pub enum Command { #[serde(rename = "ping")] Ping(usize), - #[serde(rename = "close")] - Close(Option), } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 5201422ef..a457076e3 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -4,6 +4,7 @@ use std::time::Duration; use actix::prelude::*; use actix_web::ws; +use actix_web::ws::CloseReason; use hashbrown::HashMap; use crate::{ @@ -15,6 +16,10 @@ use crate::{ /// How long before lack of client message causes a timeout. const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); +/// Message for close old member session when reconnect [`Web Client`]. +#[derive(Message)] +struct Close(Option); + /// Websocket connection is long running connection, it easier /// to handle with an actor. #[derive(Debug)] @@ -42,7 +47,9 @@ impl WsSessions { } self.idle_timeout_handler = Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |_, ctx| { - ctx.notify(Command::Close(Some(ws::CloseCode::Away.into()))); + debug!("Client timeout"); + ctx.close(Some(ws::CloseCode::Away.into())); + ctx.stop(); })); } } @@ -53,14 +60,13 @@ impl Actor for WsSessions { /// Start the heartbeat process and store session in repository /// on start [`Member`] session. fn started(&mut self, ctx: &mut Self::Context) { - let mut session_repo: WsSessionRepository = - ctx.state().session_repo.lock().unwrap(); + self.hb(ctx); + let mut session_repo = ctx.state().session_repo.lock().unwrap(); if let Some(old) = session_repo.add_session(self.member_id, ctx.address()) { - old.send(Command::Close(None)); + old.do_send(Close(None)); } - self.hb(ctx); } /// Remove [`Member`] session repository after stopped session. @@ -70,6 +76,16 @@ impl Actor for WsSessions { } } +/// Handler for `Close`. +impl Handler for WsSessions { + type Result = (); + + fn handle(&mut self, close: Close, ctx: &mut Self::Context) { + ctx.close(close.0); + ctx.stop(); + } +} + /// Handler for `Command`. impl Handler for WsSessions { type Result = (); @@ -79,10 +95,6 @@ impl Handler for WsSessions { Command::Ping(n) => { ctx.text(serde_json::to_string(&Event::Pong(n)).unwrap()) } - Command::Close(reason) => { - ctx.close(reason); - ctx.stop(); - } }; } } @@ -94,7 +106,7 @@ impl StreamHandler for WsSessions { ws::Message::Text(text) => { match serde_json::from_str::(&text) { Ok(command) => { - println!("Received command:\n{:?}\n", command); + debug!("Received command:\n{:?}\n", command); ctx.notify(command); self.hb(ctx); } @@ -103,8 +115,10 @@ impl StreamHandler for WsSessions { } } } - ws::Message::Binary(_) => ctx.notify(Command::Close(None)), - ws::Message::Close(reason) => ctx.notify(Command::Close(reason)), + ws::Message::Close(reason) => { + ctx.close(reason); + ctx.stop(); + } _ => (), } } From 4b0a60b8c9d119355321a36c108345ce9f2fe4e3 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 7 Feb 2019 12:48:00 +0200 Subject: [PATCH 030/179] Add docs --- config.default.toml | 5 +++++ src/settings/duration.rs | 1 + src/settings/mod.rs | 3 +++ src/settings/server.rs | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 config.default.toml diff --git a/config.default.toml b/config.default.toml new file mode 100644 index 000000000..ebf1a99ce --- /dev/null +++ b/config.default.toml @@ -0,0 +1,5 @@ +[server] +# Timeout for websocket session to wait message from [`Web Client`]. +# +# Default: +# idle_timeout = "10s" diff --git a/src/settings/duration.rs b/src/settings/duration.rs index c0a23862d..695666f6c 100644 --- a/src/settings/duration.rs +++ b/src/settings/duration.rs @@ -1,3 +1,4 @@ +/// Provides deserialize [`time::Duration`] from string. use std::fmt; use std::time::Duration; diff --git a/src/settings/mod.rs b/src/settings/mod.rs index 5810a1cdb..b8f77d051 100644 --- a/src/settings/mod.rs +++ b/src/settings/mod.rs @@ -1,3 +1,6 @@ +/// Provides application configuration options. +/// +/// Configuration options can be parsed from config files in TOML format. use config::{Config, Environment, File, FileFormat}; use failure::Error; use serde_derive::{Deserialize, Serialize}; diff --git a/src/settings/server.rs b/src/settings/server.rs index 0826c64fd..87dfbafac 100644 --- a/src/settings/server.rs +++ b/src/settings/server.rs @@ -4,13 +4,16 @@ use serde_derive::{Deserialize, Serialize}; use crate::settings::duration; +/// Server represents [server] configuration section. #[derive(Debug, Deserialize, Serialize)] pub struct Server { + /// Timeout for websocket session to wait message from [`Web Client`]. #[serde(serialize_with = "duration::serialize")] #[serde(deserialize_with = "duration::deserialize")] client_idle_timeout: Duration, } +/// Default returns default configuration parameters of [server] section. impl Default for Server { fn default() -> Server { Server { From 7edfc62e9dea290a30371a8ae5aaf6ef298c4d4b Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 8 Feb 2019 12:01:30 +0200 Subject: [PATCH 031/179] Add heartbeat messages --- src/api/client/commands.rs | 9 ------- src/api/client/events.rs | 8 ------ src/api/client/mod.rs | 4 +-- src/api/client/session.rs | 55 +++++++++++++++----------------------- 4 files changed, 23 insertions(+), 53 deletions(-) delete mode 100644 src/api/client/commands.rs delete mode 100644 src/api/client/events.rs diff --git a/src/api/client/commands.rs b/src/api/client/commands.rs deleted file mode 100644 index e0cf10a7f..000000000 --- a/src/api/client/commands.rs +++ /dev/null @@ -1,9 +0,0 @@ -use actix::Message; -use serde_derive::Deserialize; - -/// Command is WebSocket messages sent by [`Web Client`] to [`Media Server`]. -#[derive(Debug, Message, Deserialize)] -pub enum Command { - #[serde(rename = "ping")] - Ping(usize), -} diff --git a/src/api/client/events.rs b/src/api/client/events.rs deleted file mode 100644 index 25736b0e7..000000000 --- a/src/api/client/events.rs +++ /dev/null @@ -1,8 +0,0 @@ -use serde_derive::Serialize; - -/// Event is WebSocket messages sent by [`Media Server`] to [`Web Client`]. -#[derive(Debug, Serialize)] -pub enum Event { - #[serde(rename = "pong")] - Pong(usize), -} diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index baed28332..72e5481c4 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,6 +1,4 @@ -pub mod commands; -pub mod events; pub mod server; pub mod session; -pub use self::{commands::Command, events::Event, server::*, session::*}; +pub use self::{server::*, session::*}; diff --git a/src/api/client/session.rs b/src/api/client/session.rs index a457076e3..0abba2ff5 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -6,12 +6,9 @@ use actix::prelude::*; use actix_web::ws; use actix_web::ws::CloseReason; use hashbrown::HashMap; +use serde_derive::{Deserialize, Serialize}; -use crate::{ - api::client::{AppState, Command, Event}, - api::control::member::Id, - log::prelude::*, -}; +use crate::{api::client::AppState, api::control::member::Id, log::prelude::*}; /// How long before lack of client message causes a timeout. const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); @@ -20,6 +17,15 @@ const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); #[derive(Message)] struct Close(Option); +/// Messages to keep [`Web Client`] alive. +#[derive(Debug, Deserialize, Serialize)] +pub enum Heartbeat { + #[serde(rename = "ping")] + Ping(usize), + #[serde(rename = "pong")] + Pong(usize), +} + /// Websocket connection is long running connection, it easier /// to handle with an actor. #[derive(Debug)] @@ -48,8 +54,7 @@ impl WsSessions { self.idle_timeout_handler = Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |_, ctx| { debug!("Client timeout"); - ctx.close(Some(ws::CloseCode::Away.into())); - ctx.stop(); + ctx.notify(Close(Some(ws::CloseCode::Away.into()))); })); } } @@ -86,39 +91,23 @@ impl Handler for WsSessions { } } -/// Handler for `Command`. -impl Handler for WsSessions { - type Result = (); - - fn handle(&mut self, command: Command, ctx: &mut Self::Context) { - match command { - Command::Ping(n) => { - ctx.text(serde_json::to_string(&Event::Pong(n)).unwrap()) - } - }; - } -} - /// Handler for `ws::Message` impl StreamHandler for WsSessions { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { ws::Message::Text(text) => { - match serde_json::from_str::(&text) { - Ok(command) => { - debug!("Received command:\n{:?}\n", command); - ctx.notify(command); - self.hb(ctx); + match serde_json::from_str::(&text) { + Ok(Heartbeat::Ping(n)) => { + debug!("Received ping: {}", n); + ctx.text( + serde_json::to_string(&Heartbeat::Pong(n)).unwrap(), + ) } - Err(e) => { - ctx.text(format!("Could not parse command: {}\n", e)); - } - } - } - ws::Message::Close(reason) => { - ctx.close(reason); - ctx.stop(); + _ => {} + }; + self.hb(ctx); } + ws::Message::Close(reason) => ctx.notify(Close(reason)), _ => (), } } From 0ca49875097be5902b96c60ef8fb46b6bb6e0fc7 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 8 Feb 2019 12:31:40 +0200 Subject: [PATCH 032/179] Impl handle heartbeat messages --- src/api/client/session.rs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 0abba2ff5..e4528c25a 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -18,7 +18,7 @@ const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); struct Close(Option); /// Messages to keep [`Web Client`] alive. -#[derive(Debug, Deserialize, Serialize)] +#[derive(Debug, Message, Deserialize, Serialize)] pub enum Heartbeat { #[serde(rename = "ping")] Ping(usize), @@ -91,19 +91,25 @@ impl Handler for WsSessions { } } +/// Handler for `Heartbeat`. +impl Handler for WsSessions { + type Result = (); + + fn handle(&mut self, msg: Heartbeat, ctx: &mut Self::Context) { + if let Heartbeat::Ping(n) = msg { + debug!("Received ping: {}", n); + ctx.text(serde_json::to_string(&Heartbeat::Pong(n)).unwrap()) + } + } +} + /// Handler for `ws::Message` impl StreamHandler for WsSessions { fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { match msg { ws::Message::Text(text) => { - match serde_json::from_str::(&text) { - Ok(Heartbeat::Ping(n)) => { - debug!("Received ping: {}", n); - ctx.text( - serde_json::to_string(&Heartbeat::Pong(n)).unwrap(), - ) - } - _ => {} + if let Ok(msg) = serde_json::from_str::(&text) { + ctx.notify(msg); }; self.hb(ctx); } From 76ae3b0e2d3fdd0db7bc19a981ec4e691347857e Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 12 Feb 2019 13:47:57 +0200 Subject: [PATCH 033/179] Refactoring repositories --- src/api/client/server.rs | 26 +++++++++----------- src/api/client/session.rs | 50 +++++++++++++++++++++++---------------- src/api/control/member.rs | 15 ++++++++---- src/main.rs | 4 +--- 4 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/api/client/server.rs b/src/api/client/server.rs index b97ed3a63..bee8f9afb 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -1,40 +1,36 @@ //! Implementation HTTP server for handle websocket connections. -use std::sync::{Arc, Mutex}; - use actix_web::{ http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, Path, State, }; use crate::{ - api::client::session::{WsSessionRepository, WsSessions}, + api::client::session::{WsSessionRepository, WsSessionState, WsSessions}, api::control::member::MemberRepository, log::prelude::*, }; /// Do websocket handshake and start `WsSessions` actor fn ws_index( - (r, creds, state): (HttpRequest, Path, State), + (r, creds, state): ( + HttpRequest, + Path, + State, + ), ) -> Result { - let member_repo = state.members_repo.lock().unwrap(); - match member_repo.get_by_credentials(creds.as_str()) { + match state.members_repo.get_by_credentials(creds.as_str()) { Some(member) => ws::start(&r, WsSessions::new(member.id)), None => Ok(HttpResponse::NotFound().finish()), } } -/// State with repositories addresses -pub struct AppState { - pub members_repo: Arc>, - pub session_repo: Arc>, -} - -pub fn run(members_repo: Arc>) { - let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); +/// Starts HTTP server for handle websocket upgrade request. +pub fn run(members_repo: MemberRepository) { + let session_repo = WsSessionRepository::default(); server::new(move || { - App::with_state(AppState { + App::with_state(WsSessionState { members_repo: members_repo.clone(), session_repo: session_repo.clone(), }) diff --git a/src/api/client/session.rs b/src/api/client/session.rs index e4528c25a..411fbb377 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,5 +1,6 @@ //! Member websocket session definitions and implementations. +use std::sync::{Arc, Mutex}; use std::time::Duration; use actix::prelude::*; @@ -8,7 +9,10 @@ use actix_web::ws::CloseReason; use hashbrown::HashMap; use serde_derive::{Deserialize, Serialize}; -use crate::{api::client::AppState, api::control::member::Id, log::prelude::*}; +use crate::{ + api::control::member::{Id, MemberRepository}, + log::prelude::*, +}; /// How long before lack of client message causes a timeout. const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); @@ -26,6 +30,12 @@ pub enum Heartbeat { Pong(usize), } +/// State with repositories addresses +pub struct WsSessionState { + pub members_repo: MemberRepository, + pub session_repo: WsSessionRepository, +} + /// Websocket connection is long running connection, it easier /// to handle with an actor. #[derive(Debug)] @@ -45,9 +55,9 @@ impl WsSessions { } } - /// Helper method that update read timeout handler after every message + /// Helper method that set idle timeout handler after every message /// from [`Web Client`]. - fn hb(&mut self, ctx: &mut ::Context) { + fn set_idle_timeout(&mut self, ctx: &mut ::Context) { if let Some(handler) = self.idle_timeout_handler { ctx.cancel_future(handler); } @@ -60,13 +70,13 @@ impl WsSessions { } impl Actor for WsSessions { - type Context = ws::WebsocketContext; + type Context = ws::WebsocketContext; /// Start the heartbeat process and store session in repository /// on start [`Member`] session. fn started(&mut self, ctx: &mut Self::Context) { - self.hb(ctx); - let mut session_repo = ctx.state().session_repo.lock().unwrap(); + self.set_idle_timeout(ctx); + let mut session_repo = ctx.state().session_repo.clone(); if let Some(old) = session_repo.add_session(self.member_id, ctx.address()) { @@ -76,7 +86,7 @@ impl Actor for WsSessions { /// Remove [`Member`] session repository after stopped session. fn stopped(&mut self, ctx: &mut Self::Context) { - let mut session_repo = ctx.state().session_repo.lock().unwrap(); + let mut session_repo = ctx.state().session_repo.clone(); session_repo.remove_session(self.member_id); } } @@ -111,7 +121,7 @@ impl StreamHandler for WsSessions { if let Ok(msg) = serde_json::from_str::(&text) { ctx.notify(msg); }; - self.hb(ctx); + self.set_idle_timeout(ctx); } ws::Message::Close(reason) => ctx.notify(Close(reason)), _ => (), @@ -123,43 +133,43 @@ impl StreamHandler for WsSessions { type Client = Addr; /// Repository that stores [`Member`] sessions. -#[derive(Default, Debug)] +#[derive(Clone, Default, Debug)] pub struct WsSessionRepository { - sessions: HashMap, + sessions: Arc>>, } impl WsSessionRepository { /// Stores address of [`Member`] session in repository. pub fn add_session(&mut self, id: Id, client: Client) -> Option { debug!("add session for member: {}", id); - self.sessions.insert(id, client) + let mut sessions = self.sessions.lock().unwrap(); + sessions.insert(id, client) } /// Removes address of [`Member`] session in repository. pub fn remove_session(&mut self, id: Id) { debug!("remove session for member: {}", id); - self.sessions.remove(&id); + let mut sessions = self.sessions.lock().unwrap(); + sessions.remove(&id); } } #[cfg(test)] mod tests { - use std::sync::{Arc, Mutex}; use std::thread; use actix_web::{error, http, test, App}; use futures::stream::Stream; use super::*; - use crate::api::control::*; #[test] fn connect_by_credentials() { - let members_repo = Arc::new(Mutex::new(MemberRepository::default())); - let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); + let members_repo = MemberRepository::default(); + let session_repo = WsSessionRepository::default(); let mut srv = test::TestServer::with_factory(move || { - App::with_state(AppState { + App::with_state(WsSessionState { members_repo: members_repo.clone(), session_repo: session_repo.clone(), }) @@ -177,11 +187,11 @@ mod tests { #[test] fn disconnect_by_timeout() { - let members_repo = Arc::new(Mutex::new(MemberRepository::default())); - let session_repo = Arc::new(Mutex::new(WsSessionRepository::default())); + let members_repo = MemberRepository::default(); + let session_repo = WsSessionRepository::default(); let mut srv = test::TestServer::with_factory(move || { - App::with_state(AppState { + App::with_state(WsSessionState { members_repo: members_repo.clone(), session_repo: session_repo.clone(), }) diff --git a/src/api/control/member.rs b/src/api/control/member.rs index d566502dc..d1087b931 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,4 +1,5 @@ //! Member definitions and implementations. +use std::sync::{Arc, Mutex}; use hashbrown::HashMap; @@ -17,28 +18,32 @@ pub struct Member { } /// Repository that stores [`Member`]s. -#[derive(Default)] +#[derive(Clone, Default)] pub struct MemberRepository { - members: HashMap, + members: Arc>>, } impl MemberRepository { /// Creates new [`Member`]s repository with passed-in [`Member`]s. pub fn new(members: HashMap) -> Self { - MemberRepository { members } + MemberRepository { + members: Arc::new(Mutex::new(members)), + } } /// Returns [`Member`] by its ID. #[allow(dead_code)] pub fn get(&self, id: Id) -> Option { debug!("retrieve member by id: {}", id); - self.members.get(&id).map(|member| member.clone()) + let members = self.members.lock().unwrap(); + members.get(&id).map(|member| member.clone()) } /// Returns [`Member`] by its credentials. pub fn get_by_credentials(&self, credentials: &str) -> Option { debug!("retrieve member by credentials: {}", credentials); - self.members + let members = self.members.lock().unwrap(); + members .values() .find(|member| member.credentials.eq(credentials)) .map(|member| member.clone()) diff --git a/src/main.rs b/src/main.rs index f09e222f7..c88302764 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,4 @@ //! Medea media server application. -use std::sync::{Arc, Mutex}; - use actix::prelude::*; use dotenv::dotenv; @@ -24,7 +22,7 @@ fn main() { 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let members_repo = Arc::new(Mutex::new(MemberRepository::new(members))); + let members_repo = MemberRepository::new(members); let sys = System::new("medea"); server::run(members_repo); From 00c76101ee3f968f85e6896e47b91040a7eff321 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 13 Feb 2019 13:47:30 +0200 Subject: [PATCH 034/179] Impl simple peer state machine --- Cargo.lock | 7 +++++ Cargo.toml | 1 + src/main.rs | 1 + src/media/mod.rs | 3 +++ src/media/peer.rs | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+) create mode 100644 src/media/mod.rs create mode 100644 src/media/peer.rs diff --git a/Cargo.lock b/Cargo.lock index a83447acf..272a5073f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,6 +8,11 @@ dependencies = [ "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "assert_matches" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "autocfg" version = "0.1.2" @@ -153,6 +158,7 @@ dependencies = [ name = "medea" version = "0.1.0" dependencies = [ + "assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -463,6 +469,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" +"checksum assert_matches 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7deb0a829ca7bcfaf5da70b073a8d128619259a7be8216a355e23f00763059e5" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" diff --git a/Cargo.toml b/Cargo.toml index 7281bb4ae..21e61fe61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ readme = "README.md" repository = "https://github.com/instrumentisto/medea" [dependencies] +assert_matches = "1.3" chrono = "0.4" hashbrown = "0.1" slog = { version = "2.4", features = ["max_level_debug", "release_max_level_warn"] } diff --git a/src/main.rs b/src/main.rs index 2a30589d0..109267757 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ mod utils; mod api; mod log; +mod media; fn main() { let logger = log::new_dual_logger(std::io::stdout(), std::io::stderr()); diff --git a/src/media/mod.rs b/src/media/mod.rs new file mode 100644 index 000000000..00875fe22 --- /dev/null +++ b/src/media/mod.rs @@ -0,0 +1,3 @@ +pub mod peer; + +pub use self::peer::*; diff --git a/src/media/peer.rs b/src/media/peer.rs new file mode 100644 index 000000000..67c90a41a --- /dev/null +++ b/src/media/peer.rs @@ -0,0 +1,69 @@ +use crate::{api::control::member, log::prelude::*}; + +#[derive(Debug, PartialEq)] +pub enum PeerMachine { + New(Peer), + WaitLocalSDP(Peer), + WaitLocalHaveRemote(Peer), + WaitRemoteSDP(Peer), + Stable(Peer), + Finished(Peer), + Failure, +} + +pub enum Command { + MakeSdpOffer, + MakeSdpAnswer +} + +/// ID of [`Peer`]. +pub type Id = u64; + +#[derive(Debug, PartialEq)] +struct Peer { + id: Id, + member_id: member::Id, +} + +impl PeerMachine { + pub fn new(id: Id, member_id: member::Id) -> Self { + PeerMachine::New(Peer{id, member_id}) + } + + pub fn approve(self, c: Option) -> Self { + match (self, c) { + (PeerMachine::New(peer), None) => { + PeerMachine::WaitLocalSDP(peer) + }, + (PeerMachine::New(peer), Some(Command::MakeSdpOffer)) => { + PeerMachine::WaitLocalHaveRemote(peer) + }, + (PeerMachine::WaitLocalSDP(peer), Some(Command::MakeSdpOffer)) => { + PeerMachine::WaitRemoteSDP(peer) + }, + (PeerMachine::WaitLocalHaveRemote(peer), Some(Command::MakeSdpOffer)) => { + PeerMachine::WaitRemoteSDP(peer) + }, + _ => PeerMachine::Failure, + } + } + + pub fn pool(&self) { + println!("{:?}", self) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use assert_matches::*; + + #[test] + fn create_peer() { + let peer = PeerMachine::new(1, 1); + let peer = peer.approve(None); + peer.pool(); + + assert_matches!(peer, PeerMachine::WaitLocalSDP(Peer{id: 1, member_id: 1})); + } +} From 3e37b5b2221d58173ae08200dafe02700050a60c Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 13 Feb 2019 17:45:48 +0200 Subject: [PATCH 035/179] Remove redudant serde_derive dependency --- Cargo.lock | 4 +++- Cargo.toml | 3 +-- src/api/client/session.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2423474af..399918bca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -680,7 +680,6 @@ dependencies = [ "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1144,6 +1143,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "serde" version = "1.0.84" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde_derive 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "serde_derive" diff --git a/Cargo.toml b/Cargo.toml index f35e5f56f..2de71e500 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,7 @@ chrono = "0.4" dotenv = "0.13" futures = "0.1" hashbrown = "0.1" -serde = "1.0" -serde_derive = "1.0" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" slog = "2.4" slog-envlogger = "2.1" diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 411fbb377..44af0d372 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -7,7 +7,7 @@ use actix::prelude::*; use actix_web::ws; use actix_web::ws::CloseReason; use hashbrown::HashMap; -use serde_derive::{Deserialize, Serialize}; +use serde::{Deserialize, Serialize}; use crate::{ api::control::member::{Id, MemberRepository}, From 3183780844e94c7c7ebcdc2de021e6a5c7371a0a Mon Sep 17 00:00:00 2001 From: tyranron Date: Wed, 13 Feb 2019 19:22:49 +0200 Subject: [PATCH 036/179] Refactor --- src/api/client/mod.rs | 2 + src/api/client/server.rs | 31 +++--- src/api/client/session.rs | 204 ++++++++++++++++++++------------------ src/api/control/member.rs | 6 +- 4 files changed, 130 insertions(+), 113 deletions(-) diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 72e5481c4..4022bf7ee 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,3 +1,5 @@ +//! Implementation of Client API. + pub mod server; pub mod session; diff --git a/src/api/client/server.rs b/src/api/client/server.rs index bee8f9afb..7ab9fd788 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -1,4 +1,4 @@ -//! Implementation HTTP server for handle websocket connections. +//! HTTP server for handling WebSocket connections of Client API. use actix_web::{ http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, Path, @@ -6,42 +6,45 @@ use actix_web::{ }; use crate::{ - api::client::session::{WsSessionRepository, WsSessionState, WsSessions}, - api::control::member::MemberRepository, + api::{ + client::session::{WsSession, WsSessionContext, WsSessionRepository}, + control::member::MemberRepository, + }, log::prelude::*, }; -/// Do websocket handshake and start `WsSessions` actor +/// Handles all HTTP requests, performs WebSocket handshake (upgrade) and starts +/// new [`WsSessions`] actor for WebSocket connection. fn ws_index( (r, creds, state): ( - HttpRequest, + HttpRequest, Path, - State, + State, ), ) -> Result { - match state.members_repo.get_by_credentials(creds.as_str()) { - Some(member) => ws::start(&r, WsSessions::new(member.id)), + match state.members.get_by_credentials(creds.as_str()) { + Some(member) => ws::start(&r, WsSession::new(member.id)), None => Ok(HttpResponse::NotFound().finish()), } } -/// Starts HTTP server for handle websocket upgrade request. +/// Starts HTTP server for handling WebSocket connections. pub fn run(members_repo: MemberRepository) { let session_repo = WsSessionRepository::default(); server::new(move || { - App::with_state(WsSessionState { - members_repo: members_repo.clone(), - session_repo: session_repo.clone(), + App::with_state(WsSessionContext { + members: members_repo.clone(), + sessions: session_repo.clone(), }) .middleware(middleware::Logger::default()) .resource("/ws/{credentials}", |r| { r.method(http::Method::GET).with(ws_index) }) }) - .bind("127.0.0.1:8080") + .bind("0.0.0.0:8080") .unwrap() .start(); - info!("Started http server: 127.0.0.1:8080"); + info!("Started HTTP server on 0.0.0.0:8080"); } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 44af0d372..d65b2bb92 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,127 +1,143 @@ -//! Member websocket session definitions and implementations. +//! WebSocket session. -use std::sync::{Arc, Mutex}; -use std::time::Duration; +use std::{ + sync::{Arc, Mutex}, + time::Duration, +}; use actix::prelude::*; -use actix_web::ws; -use actix_web::ws::CloseReason; +use actix_web::ws::{self, CloseReason}; use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use crate::{ - api::control::member::{Id, MemberRepository}, + api::control::member::{self, MemberRepository}, log::prelude::*, }; -/// How long before lack of client message causes a timeout. -const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); - -/// Message for close old member session when reconnect [`Web Client`]. -#[derive(Message)] -struct Close(Option); +/// Timeout of receiving any WebSocket messages from client. +const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); // TODO: via conf -/// Messages to keep [`Web Client`] alive. -#[derive(Debug, Message, Deserialize, Serialize)] -pub enum Heartbeat { - #[serde(rename = "ping")] - Ping(usize), - #[serde(rename = "pong")] - Pong(usize), -} - -/// State with repositories addresses -pub struct WsSessionState { - pub members_repo: MemberRepository, - pub session_repo: WsSessionRepository, +/// Context for [`WsSession`] which holds all the necessary dependencies. +pub struct WsSessionContext { + /// Repository of all currently existing [`Member`]s in application. + pub members: MemberRepository, + /// Repository of all currently existing [`WsSession`]s in application. + pub sessions: WsSessionRepository, } -/// Websocket connection is long running connection, it easier -/// to handle with an actor. +/// Long-running WebSocket connection of Client API. #[derive(Debug)] -pub struct WsSessions { - member_id: Id, - /// Client must send any text message at least once per 10 seconds - /// (CLIENT_IDLE_TIMEOUT), otherwise we drop connection. - idle_timeout_handler: Option, +pub struct WsSession { + /// ID of [`Member`] that WebSocket connection is associated with. + member_id: member::Id, + + /// Handle for watchdog which checks whether WebSocket client became + /// idle (no `ping` messages received during [`CLIENT_IDLE_TIMEOUT`]). + /// + /// This one should be renewed on any received WebSocket message + /// from client. + idle_handler: Option, } -impl WsSessions { - /// Creates new [`Member`] session with passed-in [`Member`] ID. - pub fn new(member_id: Id) -> Self { +impl WsSession { + /// Creates new WebSocket session for specified [`Member`]. + pub fn new(id: member::Id) -> Self { Self { - member_id, - idle_timeout_handler: None, + member_id: id, + idle_handler: None, } } - /// Helper method that set idle timeout handler after every message - /// from [`Web Client`]. - fn set_idle_timeout(&mut self, ctx: &mut ::Context) { - if let Some(handler) = self.idle_timeout_handler { + /// Resets idle handler watchdog. + fn reset_idle_timeout(&mut self, ctx: &mut ::Context) { + if let Some(handler) = self.idle_handler { ctx.cancel_future(handler); } - self.idle_timeout_handler = + self.idle_handler = Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |_, ctx| { - debug!("Client timeout"); + debug!("Client timeouted"); ctx.notify(Close(Some(ws::CloseCode::Away.into()))); })); } } -impl Actor for WsSessions { - type Context = ws::WebsocketContext; +/// [`Actor`] implementation that provides an ergonomic way to deal with +/// WebSocket connection lifecycle for [`WsSession`]. +impl Actor for WsSession { + type Context = ws::WebsocketContext; - /// Start the heartbeat process and store session in repository - /// on start [`Member`] session. + /// Starts [`Heartbeat`] mechanism and stores [`WsSession`] + /// in [`WsSessionRepository`] of application. + /// + /// If some [`WsSession`] already exists in [`WsSessionRepository`] for + /// associated [`Member`], then it will be replaced and closed. fn started(&mut self, ctx: &mut Self::Context) { - self.set_idle_timeout(ctx); - let mut session_repo = ctx.state().session_repo.clone(); - if let Some(old) = - session_repo.add_session(self.member_id, ctx.address()) - { + self.reset_idle_timeout(ctx); + + let mut repo = ctx.state().sessions.clone(); + if let Some(old) = repo.replace_session(self.member_id, ctx.address()) { old.do_send(Close(None)); } } - /// Remove [`Member`] session repository after stopped session. + /// Removes [`WsSession`] from [`WsSessionRepository`] of application. fn stopped(&mut self, ctx: &mut Self::Context) { - let mut session_repo = ctx.state().session_repo.clone(); - session_repo.remove_session(self.member_id); + let mut repo = ctx.state().sessions.clone(); + repo.remove_session(self.member_id); } } -/// Handler for `Close`. -impl Handler for WsSessions { +/// Message for closing obsolete [`WsSession`] on client reconnection. +#[derive(Message)] +struct Close(Option); + +impl Handler for WsSession { type Result = (); + /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. fn handle(&mut self, close: Close, ctx: &mut Self::Context) { ctx.close(close.0); ctx.stop(); } } -/// Handler for `Heartbeat`. -impl Handler for WsSessions { +/// Message for keeping client WebSocket connection alive. +#[derive(Debug, Message, Deserialize, Serialize)] +pub enum Heartbeat { + /// `ping` message that WebSocket client is expected to send to the server + /// periodically. + #[serde(rename = "ping")] + Ping(usize), + /// `pong` message that server answers with to WebSocket client in response + /// to received `ping` message. + #[serde(rename = "pong")] + Pong(usize), +} + +impl Handler for WsSession { type Result = (); + /// Answers with `Heartbeat::Pong` message to WebSocket client in response + /// to the received `Heartbeat::Ping` message. fn handle(&mut self, msg: Heartbeat, ctx: &mut Self::Context) { if let Heartbeat::Ping(n) = msg { - debug!("Received ping: {}", n); + trace!("Received ping: {}", n); ctx.text(serde_json::to_string(&Heartbeat::Pong(n)).unwrap()) } } } -/// Handler for `ws::Message` -impl StreamHandler for WsSessions { +impl StreamHandler for WsSession { + /// Handles arbitrary [`ws::Message`] received from WebSocket client. fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { + debug!("Received WS message: {:?}", msg); match msg { ws::Message::Text(text) => { if let Ok(msg) = serde_json::from_str::(&text) { ctx.notify(msg); - }; - self.set_idle_timeout(ctx); + } + self.reset_idle_timeout(ctx); } ws::Message::Close(reason) => ctx.notify(Close(reason)), _ => (), @@ -129,25 +145,27 @@ impl StreamHandler for WsSessions { } } -/// Address of [`Member`] session for communicate with it. -type Client = Addr; - -/// Repository that stores [`Member`] sessions. +/// Repository that stores [`WsSession`]s of [`Member`]s. #[derive(Clone, Default, Debug)] pub struct WsSessionRepository { - sessions: Arc>>, + sessions: Arc>>>, } impl WsSessionRepository { - /// Stores address of [`Member`] session in repository. - pub fn add_session(&mut self, id: Id, client: Client) -> Option { + /// Stores [`WsSession`]'s address in repository for given [`Member`] + /// and returns previous one if any. + pub fn replace_session( + &mut self, + id: member::Id, + session: Addr, + ) -> Option> { debug!("add session for member: {}", id); let mut sessions = self.sessions.lock().unwrap(); - sessions.insert(id, client) + sessions.insert(id, session) } - /// Removes address of [`Member`] session in repository. - pub fn remove_session(&mut self, id: Id) { + /// Removes address of [`WsSession`] from repository. + pub fn remove_session(&mut self, id: member::Id) { debug!("remove session for member: {}", id); let mut sessions = self.sessions.lock().unwrap(); sessions.remove(&id); @@ -155,27 +173,24 @@ impl WsSessionRepository { } #[cfg(test)] -mod tests { - use std::thread; +mod test { + use std::{ops::Add, thread}; use actix_web::{error, http, test, App}; - use futures::stream::Stream; + use futures::Stream; use super::*; #[test] - fn connect_by_credentials() { - let members_repo = MemberRepository::default(); - let session_repo = WsSessionRepository::default(); - + fn responses_with_pong() { let mut srv = test::TestServer::with_factory(move || { - App::with_state(WsSessionState { - members_repo: members_repo.clone(), - session_repo: session_repo.clone(), + App::with_state(WsSessionContext { + members: MemberRepository::default(), + sessions: WsSessionRepository::default(), }) .resource("/ws/", |r| { r.method(http::Method::GET) - .with(|r| ws::start(&r, WsSessions::new(1))) + .with(|r| ws::start(&r, WsSession::new(1))) }) }); let (reader, mut writer) = srv.ws_at("/ws/").unwrap(); @@ -186,23 +201,20 @@ mod tests { } #[test] - fn disconnect_by_timeout() { - let members_repo = MemberRepository::default(); - let session_repo = WsSessionRepository::default(); - + fn disconnects_on_idle() { let mut srv = test::TestServer::with_factory(move || { - App::with_state(WsSessionState { - members_repo: members_repo.clone(), - session_repo: session_repo.clone(), + App::with_state(WsSessionContext { + members: MemberRepository::default(), + sessions: WsSessionRepository::default(), }) - .resource("/ws/{credentials}", |r| { + .resource("/ws/", |r| { r.method(http::Method::GET) - .with(|r| ws::start(&r, WsSessions::new(1))) + .with(|r| ws::start(&r, WsSession::new(1))) }) }); - let (reader, mut writer) = srv.ws_at("/ws/caller_credentials").unwrap(); + let (reader, mut writer) = srv.ws_at("/ws/").unwrap(); - thread::sleep(CLIENT_IDLE_TIMEOUT); + thread::sleep(CLIENT_IDLE_TIMEOUT.add(Duration::from_secs(1))); writer.text(r#"{"ping":33}"#); assert!(match srv.execute(reader.into_future()) { diff --git a/src/api/control/member.rs b/src/api/control/member.rs index d1087b931..a5aebcad5 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -36,7 +36,7 @@ impl MemberRepository { pub fn get(&self, id: Id) -> Option { debug!("retrieve member by id: {}", id); let members = self.members.lock().unwrap(); - members.get(&id).map(|member| member.clone()) + members.get(&id).map(|m| m.clone()) } /// Returns [`Member`] by its credentials. @@ -45,8 +45,8 @@ impl MemberRepository { let members = self.members.lock().unwrap(); members .values() - .find(|member| member.credentials.eq(credentials)) - .map(|member| member.clone()) + .find(|m| m.credentials.eq(credentials)) + .map(|m| m.clone()) } } From 7a5117deb41684f012fb24bb04ddd223e809b809 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 21 Feb 2019 15:18:21 +0200 Subject: [PATCH 037/179] Impl room and repository of rooms --- src/api/client/mod.rs | 3 +- src/api/client/room.rs | 114 ++++++++++++++++++++++++++++ src/api/client/server.rs | 126 ++++++++++++++++++++++++++----- src/api/client/session.rs | 152 +++++++------------------------------- src/api/control/member.rs | 80 +------------------- src/api/control/mod.rs | 2 +- src/main.rs | 19 +++-- 7 files changed, 268 insertions(+), 228 deletions(-) create mode 100644 src/api/client/room.rs diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 4022bf7ee..0f3537eab 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,6 +1,7 @@ //! Implementation of Client API. +pub mod room; pub mod server; pub mod session; -pub use self::{server::*, session::*}; +pub use self::{room::*, server::*, session::*}; diff --git a/src/api/client/room.rs b/src/api/client/room.rs new file mode 100644 index 000000000..b695d2887 --- /dev/null +++ b/src/api/client/room.rs @@ -0,0 +1,114 @@ +//! Room definitions and implementations. +use std::sync::{Arc, Mutex}; + +use actix::prelude::*; +use actix_web::ws::CloseReason; +use futures::future::Future; +use hashbrown::HashMap; + +use crate::{ + api::client::{Close, WsSession}, + api::control::{Id as MemberID, Member}, + log::prelude::*, +}; + +/// ID of [`Room`]. +pub type Id = u64; + +/// Media server room with its members. +#[derive(Clone, Debug)] +pub struct Room { + /// ID of [`Room`]. + pub id: Id, + + /// [`Member`]'s this room. + pub members: HashMap, + + /// [`WsSession`]s of [`Member`]'s this room. + pub sessions: HashMap>, +} + +/// Message for to get information about [`Member`] by its credentials. +#[derive(Message)] +#[rtype(result = "Option")] +pub struct GetMember(pub String); + +impl Handler for Room { + type Result = Option; + + /// Returns [`Member`] by its credentials if it present in [`Room`]. + fn handle( + &mut self, + credentials: GetMember, + _ctx: &mut Self::Context, + ) -> Self::Result { + debug!("retrieve member by credentials: {}", credentials.0); + self.members + .values() + .find(|m| m.credentials.eq(credentials.0.as_str())) + .map(|m| m.clone()) + } +} + +/// Message from [`WsSession`] signaling what [`Member`] connected. +#[derive(Message)] +pub struct JoinMember(pub MemberID, pub Addr); + +impl Handler for Room { + type Result = (); + + /// Stores [`WsSession`] of [`Member`] into [`Room`]. + /// + /// If [`Member`] is reconnected, close and stop old [`WsSession`] + /// before store current [`WsSession`] in [`Room`]. + fn handle(&mut self, msg: JoinMember, _ctx: &mut Self::Context) { + debug!("join member: {}", msg.0); + if let Some(old_session) = self.sessions.remove(&msg.0) { + let _ = old_session.send(Close(None)).wait(); + } + self.sessions.insert(msg.0, msg.1); + } +} + +/// Message from [`WsSession`] signaling what [`Member`] closed connection +/// or become idle. +#[derive(Message)] +pub struct LeaveMember(pub MemberID, pub Option); + +impl Handler for Room { + type Result = (); + + /// Remove and close [`WsSession`] from [`Room`]. + fn handle(&mut self, msg: LeaveMember, _ctx: &mut Self::Context) { + debug!("leave member: {}", msg.0); + if let Some(session) = self.sessions.remove(&msg.0) { + session.do_send(Close(msg.1)) + } + } +} + +impl Actor for Room { + type Context = Context; +} + +/// Repository that stores [`Room`]s. +#[derive(Clone, Default)] +pub struct RoomsRepository { + rooms: Arc>>>, +} + +impl RoomsRepository { + /// Creates new [`Room`]s repository with passed-in [`Room`]s. + pub fn new(rooms: HashMap>) -> Self { + RoomsRepository { + rooms: Arc::new(Mutex::new(rooms)), + } + } + + /// Returns [`Room`] by its ID. + pub fn get(&self, id: Id) -> Option> { + debug!("retrieve room by id: {}", id); + let rooms = self.rooms.lock().unwrap(); + rooms.get(&id).map(|r| r.clone()) + } +} diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 7ab9fd788..5ece0f892 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -4,41 +4,61 @@ use actix_web::{ http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, Path, State, }; +use futures::future::Future; +use serde::Deserialize; use crate::{ - api::{ - client::session::{WsSession, WsSessionContext, WsSessionRepository}, - control::member::MemberRepository, - }, + api::client::{GetMember, Id as RoomID, RoomsRepository, WsSession}, log::prelude::*, }; +/// Contains [`Room`] ID and [`Member`] credentials obtained from request path. +#[derive(Debug, Deserialize)] +struct RequestInfo { + room_id: RoomID, + credentials: String, +} + /// Handles all HTTP requests, performs WebSocket handshake (upgrade) and starts /// new [`WsSessions`] actor for WebSocket connection. fn ws_index( - (r, creds, state): ( - HttpRequest, - Path, - State, + (r, info, state): ( + HttpRequest, + Path, + State, ), ) -> Result { - match state.members.get_by_credentials(creds.as_str()) { - Some(member) => ws::start(&r, WsSession::new(member.id)), + debug!("{:?}", info); + match state.rooms.get(info.room_id) { + Some(room_addr) => room_addr + .send(GetMember(info.credentials.clone())) + .from_err() + .and_then(|res| match res { + Some(member) => ws::start( + &r.drop_state(), + WsSession::new(member.id, room_addr), + ), + None => Ok(HttpResponse::NotFound().finish()), + }) + .wait(), None => Ok(HttpResponse::NotFound().finish()), } } -/// Starts HTTP server for handling WebSocket connections. -pub fn run(members_repo: MemberRepository) { - let session_repo = WsSessionRepository::default(); +/// Context for [`App`] which holds all the necessary dependencies. +pub struct AppContext { + /// Repository of all currently existing [`Room`]s in application. + pub rooms: RoomsRepository, +} +/// Starts HTTP server for handling WebSocket connections. +pub fn run(rooms: RoomsRepository) { server::new(move || { - App::with_state(WsSessionContext { - members: members_repo.clone(), - sessions: session_repo.clone(), + App::with_state(AppContext { + rooms: rooms.clone(), }) .middleware(middleware::Logger::default()) - .resource("/ws/{credentials}", |r| { + .resource("/ws/{room_id}/{credentials}", |r| { r.method(http::Method::GET).with(ws_index) }) }) @@ -48,3 +68,75 @@ pub fn run(members_repo: MemberRepository) { info!("Started HTTP server on 0.0.0.0:8080"); } + +#[cfg(test)] +mod test { + use std::{ops::Add, thread, time::Duration}; + + use actix::prelude::*; + use actix_web::{error, http, test, App}; + use futures::Stream; + use hashbrown::HashMap; + + use crate::api::{ + client::{session, Room}, + control::Member, + }; + + use super::*; + + fn start_room() -> RoomsRepository { + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + let room = Arbiter::start(move |_| Room { + id: 1, + members, + sessions: HashMap::new(), + }); + let rooms = hashmap! {1 => room}; + RoomsRepository::new(rooms) + } + + #[test] + fn responses_with_pong() { + let mut srv = test::TestServer::with_factory(move || { + let repo = start_room(); + App::with_state(AppContext { rooms: repo }) + .resource("/ws/{room_id}/{credentials}", |r| { + r.method(http::Method::GET).with(ws_index) + }) + }); + let (reader, mut writer) = + srv.ws_at("/ws/1/caller_credentials").unwrap(); + + writer.text(r#"{"ping":33}"#); + let (item, _reader) = srv.execute(reader.into_future()).unwrap(); + assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); + } + + #[test] + fn disconnects_on_idle() { + let mut srv = test::TestServer::with_factory(move || { + let repo = start_room(); + App::with_state(AppContext { rooms: repo }) + .resource("/ws/{room_id}/{credentials}", |r| { + r.method(http::Method::GET).with(ws_index) + }) + }); + let (reader, mut writer) = + srv.ws_at("/ws/1/caller_credentials").unwrap(); + + thread::sleep(session::CLIENT_IDLE_TIMEOUT.add(Duration::from_secs(1))); + + writer.text(r#"{"ping":33}"#); + assert!(match srv.execute(reader.into_future()) { + Err(( + ws::ProtocolError::Payload(error::PayloadError::Io(_)), + _, + )) => true, + _ => false, + }); + } +} diff --git a/src/api/client/session.rs b/src/api/client/session.rs index d65b2bb92..6bf795b2d 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,36 +1,29 @@ //! WebSocket session. -use std::{ - sync::{Arc, Mutex}, - time::Duration, -}; +use std::time::Duration; use actix::prelude::*; use actix_web::ws::{self, CloseReason}; -use hashbrown::HashMap; use serde::{Deserialize, Serialize}; use crate::{ - api::control::member::{self, MemberRepository}, + api::client::room::{JoinMember, LeaveMember, Room}, + api::control::member::Id as MemberID, log::prelude::*, }; +// TODO: via conf /// Timeout of receiving any WebSocket messages from client. -const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); // TODO: via conf - -/// Context for [`WsSession`] which holds all the necessary dependencies. -pub struct WsSessionContext { - /// Repository of all currently existing [`Member`]s in application. - pub members: MemberRepository, - /// Repository of all currently existing [`WsSession`]s in application. - pub sessions: WsSessionRepository, -} +pub const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); /// Long-running WebSocket connection of Client API. #[derive(Debug)] pub struct WsSession { /// ID of [`Member`] that WebSocket connection is associated with. - member_id: member::Id, + member_id: MemberID, + + /// [`Room`] that [`Member`] is associated with. + room: Addr, /// Handle for watchdog which checks whether WebSocket client became /// idle (no `ping` messages received during [`CLIENT_IDLE_TIMEOUT`]). @@ -42,9 +35,10 @@ pub struct WsSession { impl WsSession { /// Creates new WebSocket session for specified [`Member`]. - pub fn new(id: member::Id) -> Self { + pub fn new(member_id: MemberID, room: Addr) -> Self { Self { - member_id: id, + member_id, + room, idle_handler: None, } } @@ -55,9 +49,12 @@ impl WsSession { ctx.cancel_future(handler); } self.idle_handler = - Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |_, ctx| { - debug!("Client timeouted"); - ctx.notify(Close(Some(ws::CloseCode::Away.into()))); + Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |session, _ctx| { + debug!("Client timeout"); + session.room.do_send(LeaveMember( + session.member_id, + Some(ws::CloseCode::Away.into()), + )); })); } } @@ -65,32 +62,19 @@ impl WsSession { /// [`Actor`] implementation that provides an ergonomic way to deal with /// WebSocket connection lifecycle for [`WsSession`]. impl Actor for WsSession { - type Context = ws::WebsocketContext; + type Context = ws::WebsocketContext; - /// Starts [`Heartbeat`] mechanism and stores [`WsSession`] - /// in [`WsSessionRepository`] of application. - /// - /// If some [`WsSession`] already exists in [`WsSessionRepository`] for - /// associated [`Member`], then it will be replaced and closed. + /// Starts [`Heartbeat`] mechanism and sends message to [`Room`]. fn started(&mut self, ctx: &mut Self::Context) { + debug!("Session of member {} started", self.member_id); self.reset_idle_timeout(ctx); - - let mut repo = ctx.state().sessions.clone(); - if let Some(old) = repo.replace_session(self.member_id, ctx.address()) { - old.do_send(Close(None)); - } - } - - /// Removes [`WsSession`] from [`WsSessionRepository`] of application. - fn stopped(&mut self, ctx: &mut Self::Context) { - let mut repo = ctx.state().sessions.clone(); - repo.remove_session(self.member_id); + self.room.do_send(JoinMember(self.member_id, ctx.address())); } } -/// Message for closing obsolete [`WsSession`] on client reconnection. +/// Message sending from [`Room`] for closing [`WsSession`]. #[derive(Message)] -struct Close(Option); +pub struct Close(pub Option); impl Handler for WsSession { type Result = (); @@ -139,90 +123,10 @@ impl StreamHandler for WsSession { } self.reset_idle_timeout(ctx); } - ws::Message::Close(reason) => ctx.notify(Close(reason)), - _ => (), + ws::Message::Close(reason) => { + self.room.do_send(LeaveMember(self.member_id, reason)) + } + _ => error!("Unsupported message"), } } } - -/// Repository that stores [`WsSession`]s of [`Member`]s. -#[derive(Clone, Default, Debug)] -pub struct WsSessionRepository { - sessions: Arc>>>, -} - -impl WsSessionRepository { - /// Stores [`WsSession`]'s address in repository for given [`Member`] - /// and returns previous one if any. - pub fn replace_session( - &mut self, - id: member::Id, - session: Addr, - ) -> Option> { - debug!("add session for member: {}", id); - let mut sessions = self.sessions.lock().unwrap(); - sessions.insert(id, session) - } - - /// Removes address of [`WsSession`] from repository. - pub fn remove_session(&mut self, id: member::Id) { - debug!("remove session for member: {}", id); - let mut sessions = self.sessions.lock().unwrap(); - sessions.remove(&id); - } -} - -#[cfg(test)] -mod test { - use std::{ops::Add, thread}; - - use actix_web::{error, http, test, App}; - use futures::Stream; - - use super::*; - - #[test] - fn responses_with_pong() { - let mut srv = test::TestServer::with_factory(move || { - App::with_state(WsSessionContext { - members: MemberRepository::default(), - sessions: WsSessionRepository::default(), - }) - .resource("/ws/", |r| { - r.method(http::Method::GET) - .with(|r| ws::start(&r, WsSession::new(1))) - }) - }); - let (reader, mut writer) = srv.ws_at("/ws/").unwrap(); - - writer.text(r#"{"ping":33}"#); - let (item, _reader) = srv.execute(reader.into_future()).unwrap(); - assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); - } - - #[test] - fn disconnects_on_idle() { - let mut srv = test::TestServer::with_factory(move || { - App::with_state(WsSessionContext { - members: MemberRepository::default(), - sessions: WsSessionRepository::default(), - }) - .resource("/ws/", |r| { - r.method(http::Method::GET) - .with(|r| ws::start(&r, WsSession::new(1))) - }) - }); - let (reader, mut writer) = srv.ws_at("/ws/").unwrap(); - - thread::sleep(CLIENT_IDLE_TIMEOUT.add(Duration::from_secs(1))); - - writer.text(r#"{"ping":33}"#); - assert!(match srv.execute(reader.into_future()) { - Err(( - ws::ProtocolError::Payload(error::PayloadError::Io(_)), - _, - )) => true, - _ => false, - }); - } -} diff --git a/src/api/control/member.rs b/src/api/control/member.rs index a5aebcad5..880e666aa 100644 --- a/src/api/control/member.rs +++ b/src/api/control/member.rs @@ -1,9 +1,4 @@ //! Member definitions and implementations. -use std::sync::{Arc, Mutex}; - -use hashbrown::HashMap; - -use crate::log::prelude::*; /// ID of [`Member`]. pub type Id = u64; @@ -13,80 +8,7 @@ pub type Id = u64; pub struct Member { /// ID of [`Member`]. pub id: Id, + /// Credentials to authorize [`Member`] with. pub credentials: String, } - -/// Repository that stores [`Member`]s. -#[derive(Clone, Default)] -pub struct MemberRepository { - members: Arc>>, -} - -impl MemberRepository { - /// Creates new [`Member`]s repository with passed-in [`Member`]s. - pub fn new(members: HashMap) -> Self { - MemberRepository { - members: Arc::new(Mutex::new(members)), - } - } - - /// Returns [`Member`] by its ID. - #[allow(dead_code)] - pub fn get(&self, id: Id) -> Option { - debug!("retrieve member by id: {}", id); - let members = self.members.lock().unwrap(); - members.get(&id).map(|m| m.clone()) - } - - /// Returns [`Member`] by its credentials. - pub fn get_by_credentials(&self, credentials: &str) -> Option { - debug!("retrieve member by credentials: {}", credentials); - let members = self.members.lock().unwrap(); - members - .values() - .find(|m| m.credentials.eq(credentials)) - .map(|m| m.clone()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - - fn test_members() -> HashMap { - hashmap! { - 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, - } - } - - #[test] - fn returns_member_by_id() { - let repo = MemberRepository::new(test_members()); - - let res = repo.get(1); - assert!(res.is_some()); - let member = res.unwrap(); - assert_eq!(member.id, 1); - } - - #[test] - fn returns_member_by_credentials() { - let repo = MemberRepository::new(test_members()); - - let res = repo.get_by_credentials("responder_credentials"); - assert!(res.is_some()); - let member = res.unwrap(); - assert_eq!(member.id, 2); - assert_eq!(member.credentials, "responder_credentials"); - } - - #[test] - fn returns_error_not_found() { - let repo = MemberRepository::new(test_members()); - - let res = repo.get(999); - assert!(res.is_none()); - } -} diff --git a/src/api/control/mod.rs b/src/api/control/mod.rs index edcb52719..b29bf968d 100644 --- a/src/api/control/mod.rs +++ b/src/api/control/mod.rs @@ -2,4 +2,4 @@ pub mod member; -pub use self::member::{Id, Member, MemberRepository}; +pub use self::member::*; diff --git a/src/main.rs b/src/main.rs index c88302764..d6778a34a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,10 @@ //! Medea media server application. use actix::prelude::*; use dotenv::dotenv; +use hashbrown::HashMap; -use crate::api::client::*; -use crate::api::control::*; +use crate::api::client::{server, Room, RoomsRepository}; +use crate::api::control::Member; #[macro_use] mod utils; @@ -17,14 +18,20 @@ fn main() { let _scope_guard = slog_scope::set_global_logger(logger); let _guard = slog_stdlog::init().unwrap(); + let sys = System::new("medea"); + let members = hashmap! { 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; + let room = Arbiter::start(move |_| Room { + id: 1, + members, + sessions: HashMap::new(), + }); + let rooms = hashmap! {1 => room}; + let rooms_repo = RoomsRepository::new(rooms); - let members_repo = MemberRepository::new(members); - - let sys = System::new("medea"); - server::run(members_repo); + server::run(rooms_repo); let _ = sys.run(); } From 53ea3120558535a393dbc8471a889ace025ed5dd Mon Sep 17 00:00:00 2001 From: alexlapa Date: Fri, 22 Feb 2019 13:40:51 -0600 Subject: [PATCH 038/179] fix disconnects_on_idle test, use FutureResponse instead of HttpResponse --- src/api/client/server.rs | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 5ece0f892..d65b3b62c 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -1,10 +1,10 @@ //! HTTP server for handling WebSocket connections of Client API. use actix_web::{ - http, middleware, server, ws, App, Error, HttpRequest, HttpResponse, Path, - State, + http, middleware, server, ws, App, AsyncResponder, FutureResponse, + HttpRequest, HttpResponse, Path, State, }; -use futures::future::Future; +use futures::{future, Future}; use serde::Deserialize; use crate::{ @@ -27,21 +27,25 @@ fn ws_index( Path, State, ), -) -> Result { +) -> FutureResponse { debug!("{:?}", info); + match state.rooms.get(info.room_id) { Some(room_addr) => room_addr .send(GetMember(info.credentials.clone())) .from_err() - .and_then(|res| match res { - Some(member) => ws::start( - &r.drop_state(), - WsSession::new(member.id, room_addr), - ), - None => Ok(HttpResponse::NotFound().finish()), + .and_then(move |res| match res { + Some(member) => { + ws::start( + &r.drop_state(), + WsSession::new(member.id, room_addr), + ) + } + None => Ok(HttpResponse::NotFound().into()), }) - .wait(), - None => Ok(HttpResponse::NotFound().finish()), + .responder(), + None => future::lazy(move || Ok(HttpResponse::NotFound().into())) + .responder(), } } @@ -74,7 +78,9 @@ mod test { use std::{ops::Add, thread, time::Duration}; use actix::prelude::*; - use actix_web::{error, http, test, App}; + use actix_web::{ + http, test, ws::CloseReason, ws::Message::Close, App, + }; use futures::Stream; use hashbrown::HashMap; @@ -84,6 +90,7 @@ mod test { }; use super::*; + use actix_web::ws::CloseCode; fn start_room() -> RoomsRepository { let members = hashmap! { @@ -132,10 +139,7 @@ mod test { writer.text(r#"{"ping":33}"#); assert!(match srv.execute(reader.into_future()) { - Err(( - ws::ProtocolError::Payload(error::PayloadError::Io(_)), - _, - )) => true, + Ok((Some(Close(Some(CloseReason { code: CloseCode::Away, description: None }))),_)) => true, _ => false, }); } From 0c650d0e763fc2088a10e2afb35a675444699c28 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Mon, 25 Feb 2019 00:02:51 -0600 Subject: [PATCH 039/179] abstract on transport --- Cargo.lock | 1 + Cargo.toml | 1 + src/api/client/room.rs | 106 +++++++++++++++++++++++--------------- src/api/client/server.rs | 28 +++++----- src/api/client/session.rs | 95 +++++++++++++++++++++++++--------- src/main.rs | 2 +- 6 files changed, 156 insertions(+), 77 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 399918bca..70971501e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,6 +677,7 @@ dependencies = [ "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 2de71e500..920fe3541 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,3 +24,4 @@ slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" +failure = "0.1.5" diff --git a/src/api/client/room.rs b/src/api/client/room.rs index b695d2887..817457e31 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -2,21 +2,19 @@ use std::sync::{Arc, Mutex}; use actix::prelude::*; -use actix_web::ws::CloseReason; -use futures::future::Future; use hashbrown::HashMap; use crate::{ - api::client::{Close, WsSession}, api::control::{Id as MemberID, Member}, log::prelude::*, }; +use std::fmt::Debug; /// ID of [`Room`]. pub type Id = u64; /// Media server room with its members. -#[derive(Clone, Debug)] +#[derive(Debug)] pub struct Room { /// ID of [`Room`]. pub id: Id, @@ -25,13 +23,42 @@ pub struct Room { pub members: HashMap, /// [`WsSession`]s of [`Member`]'s this room. - pub sessions: HashMap>, + pub connections: HashMap>, +} + +impl Actor for Room { + type Context = Context; +} + +pub trait RpcConnection: Debug + Send { + fn get_member_id(&self) -> Result>; + + fn close(&self); +} + +#[derive(Message, Debug)] +pub struct RpcConnectionEstablished { + pub connection: Box, } /// Message for to get information about [`Member`] by its credentials. -#[derive(Message)] +#[derive(Message, Debug)] #[rtype(result = "Option")] -pub struct GetMember(pub String); +pub struct GetMember { + pub credentials: String, +} + +#[derive(Message, Debug)] +pub struct RpcConnectionClosed { + pub member_id: MemberID, + pub reason: RpcConnectionClosedReason, +} + +#[derive(Debug)] +pub enum RpcConnectionClosedReason { + Disconnect, + Idle, +} impl Handler for Room { type Result = Option; @@ -39,58 +66,56 @@ impl Handler for Room { /// Returns [`Member`] by its credentials if it present in [`Room`]. fn handle( &mut self, - credentials: GetMember, + msg: GetMember, _ctx: &mut Self::Context, ) -> Self::Result { - debug!("retrieve member by credentials: {}", credentials.0); self.members .values() - .find(|m| m.credentials.eq(credentials.0.as_str())) + .find(|m| m.credentials.eq(msg.credentials.as_str())) .map(|m| m.clone()) } } -/// Message from [`WsSession`] signaling what [`Member`] connected. -#[derive(Message)] -pub struct JoinMember(pub MemberID, pub Addr); - -impl Handler for Room { +impl Handler for Room { type Result = (); - /// Stores [`WsSession`] of [`Member`] into [`Room`]. - /// - /// If [`Member`] is reconnected, close and stop old [`WsSession`] - /// before store current [`WsSession`] in [`Room`]. - fn handle(&mut self, msg: JoinMember, _ctx: &mut Self::Context) { - debug!("join member: {}", msg.0); - if let Some(old_session) = self.sessions.remove(&msg.0) { - let _ = old_session.send(Close(None)).wait(); + fn handle( + &mut self, + msg: RpcConnectionEstablished, + _ctx: &mut Self::Context, + ) -> Self::Result { + let member_id = msg.connection.get_member_id(); + + info!("RpcConnectionEstablished with member {:?}", &member_id); + + match member_id { + Ok(member_id) => { + if let Some(old_session) = self.connections.remove(&member_id) { + old_session.close(); + } + self.connections.insert(member_id, msg.connection); + } + Err(e) => { + error!("{:?}", e); + msg.connection.close(); + }, } - self.sessions.insert(msg.0, msg.1); } } -/// Message from [`WsSession`] signaling what [`Member`] closed connection -/// or become idle. -#[derive(Message)] -pub struct LeaveMember(pub MemberID, pub Option); - -impl Handler for Room { +impl Handler for Room { type Result = (); - /// Remove and close [`WsSession`] from [`Room`]. - fn handle(&mut self, msg: LeaveMember, _ctx: &mut Self::Context) { - debug!("leave member: {}", msg.0); - if let Some(session) = self.sessions.remove(&msg.0) { - session.do_send(Close(msg.1)) - } + fn handle( + &mut self, + msg: RpcConnectionClosed, + _ctx: &mut Self::Context, + ) -> Self::Result { + info!("RpcConnectionClosed with member {}, reason {:?}", &msg.member_id, msg.reason); + self.connections.remove(&msg.member_id); } } -impl Actor for Room { - type Context = Context; -} - /// Repository that stores [`Room`]s. #[derive(Clone, Default)] pub struct RoomsRepository { @@ -107,7 +132,6 @@ impl RoomsRepository { /// Returns [`Room`] by its ID. pub fn get(&self, id: Id) -> Option> { - debug!("retrieve room by id: {}", id); let rooms = self.rooms.lock().unwrap(); rooms.get(&id).map(|r| r.clone()) } diff --git a/src/api/client/server.rs b/src/api/client/server.rs index d65b3b62c..b66c5954e 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -32,15 +32,15 @@ fn ws_index( match state.rooms.get(info.room_id) { Some(room_addr) => room_addr - .send(GetMember(info.credentials.clone())) + .send(GetMember { + credentials: info.credentials.clone(), + }) .from_err() .and_then(move |res| match res { - Some(member) => { - ws::start( - &r.drop_state(), - WsSession::new(member.id, room_addr), - ) - } + Some(member) => ws::start( + &r.drop_state(), + WsSession::new(member.id, room_addr), + ), None => Ok(HttpResponse::NotFound().into()), }) .responder(), @@ -78,9 +78,7 @@ mod test { use std::{ops::Add, thread, time::Duration}; use actix::prelude::*; - use actix_web::{ - http, test, ws::CloseReason, ws::Message::Close, App, - }; + use actix_web::{http, test, ws::CloseReason, ws::Message::Close, App}; use futures::Stream; use hashbrown::HashMap; @@ -100,7 +98,7 @@ mod test { let room = Arbiter::start(move |_| Room { id: 1, members, - sessions: HashMap::new(), + connections: HashMap::new(), }); let rooms = hashmap! {1 => room}; RoomsRepository::new(rooms) @@ -139,7 +137,13 @@ mod test { writer.text(r#"{"ping":33}"#); assert!(match srv.execute(reader.into_future()) { - Ok((Some(Close(Some(CloseReason { code: CloseCode::Away, description: None }))),_)) => true, + Ok(( + Some(Close(Some(CloseReason { + code: CloseCode::Away, + description: None, + }))), + _, + )) => true, _ => false, }); } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 6bf795b2d..df41a5e52 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -4,13 +4,19 @@ use std::time::Duration; use actix::prelude::*; use actix_web::ws::{self, CloseReason}; +use failure::Fail; +use futures::future::Future; use serde::{Deserialize, Serialize}; use crate::{ - api::client::room::{JoinMember, LeaveMember, Room}, + api::client::room::{ + Room, RpcConnection, RpcConnectionClosed, RpcConnectionEstablished, + RpcConnectionClosedReason + }, api::control::member::Id as MemberID, log::prelude::*, }; +use actix_web::ws::CloseCode; // TODO: via conf /// Timeout of receiving any WebSocket messages from client. @@ -48,13 +54,16 @@ impl WsSession { if let Some(handler) = self.idle_handler { ctx.cancel_future(handler); } + + let member_id = self.member_id; self.idle_handler = - Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |session, _ctx| { - debug!("Client timeout"); - session.room.do_send(LeaveMember( - session.member_id, - Some(ws::CloseCode::Away.into()), - )); + Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, move |session, ctx| { + info!("WsConnection with member {} is idle", member_id); + session.room.do_send(RpcConnectionClosed { + member_id: session.member_id, + reason: RpcConnectionClosedReason::Idle + }); + ctx.address().close(); })); } } @@ -66,24 +75,37 @@ impl Actor for WsSession { /// Starts [`Heartbeat`] mechanism and sends message to [`Room`]. fn started(&mut self, ctx: &mut Self::Context) { - debug!("Session of member {} started", self.member_id); + debug!("Started WsSession for member {}", self.member_id); self.reset_idle_timeout(ctx); - self.room.do_send(JoinMember(self.member_id, ctx.address())); + self.room.do_send(RpcConnectionEstablished { + connection: Box::new(ctx.address()), + }); + } +} + +impl RpcConnection for Addr { + fn get_member_id(&self) -> Result> { + self.send(GetMemberId {}) + .wait() + .map_err(|err: MailboxError| err.compat().into()) + } + + fn close(&self) { + self.do_send(Close { + close_frame: CloseReason::from(CloseCode::Normal), + }) } } /// Message sending from [`Room`] for closing [`WsSession`]. #[derive(Message)] -pub struct Close(pub Option); +#[rtype(result = "MemberID")] +pub struct GetMemberId(); -impl Handler for WsSession { - type Result = (); - - /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. - fn handle(&mut self, close: Close, ctx: &mut Self::Context) { - ctx.close(close.0); - ctx.stop(); - } +/// Message sending from [`Room`] for closing [`WsSession`]. +#[derive(Message)] +pub struct Close { + close_frame: CloseReason, } /// Message for keeping client WebSocket connection alive. @@ -99,6 +121,29 @@ pub enum Heartbeat { Pong(usize), } +impl Handler for WsSession { + type Result = MemberID; + + fn handle( + &mut self, + _msg: GetMemberId, + _ctx: &mut Self::Context, + ) -> Self::Result { + self.member_id + } +} + +impl Handler for WsSession { + type Result = (); + + /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. + fn handle(&mut self, close: Close, ctx: &mut Self::Context) { + debug!("Closing WsSession for member {}", self.member_id); + ctx.close(Some(close.close_frame)); + ctx.stop(); + } +} + impl Handler for WsSession { type Result = (); @@ -115,18 +160,22 @@ impl Handler for WsSession { impl StreamHandler for WsSession { /// Handles arbitrary [`ws::Message`] received from WebSocket client. fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { - debug!("Received WS message: {:?}", msg); + debug!("Received WS message: {:?} from member {}", msg, self.member_id); match msg { ws::Message::Text(text) => { + self.reset_idle_timeout(ctx); if let Ok(msg) = serde_json::from_str::(&text) { ctx.notify(msg); } - self.reset_idle_timeout(ctx); } - ws::Message::Close(reason) => { - self.room.do_send(LeaveMember(self.member_id, reason)) + ws::Message::Close(_reason) => { + self.room.do_send(RpcConnectionClosed { + member_id: self.member_id, + reason: RpcConnectionClosedReason::Disconnect + }); + ctx.stop(); } - _ => error!("Unsupported message"), + _ => error!("Unsupported message from member {}", self.member_id), } } } diff --git a/src/main.rs b/src/main.rs index d6778a34a..cd8bfa9c5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ fn main() { let room = Arbiter::start(move |_| Room { id: 1, members, - sessions: HashMap::new(), + connections: HashMap::new(), }); let rooms = hashmap! {1 => room}; let rooms_repo = RoomsRepository::new(rooms); From 96d68450c1d2647c508ddbaf83e377e8a88b2553 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 25 Feb 2019 11:37:54 +0200 Subject: [PATCH 040/179] Impl peers --- Cargo.lock | 1 + Cargo.toml | 1 + src/api/client/room.rs | 119 +++++++++++++++++++++++++++++++++++-- src/api/client/server.rs | 6 +- src/api/client/session.rs | 11 +++- src/main.rs | 6 +- src/media/mod.rs | 2 +- src/media/peer.rs | 120 ++++++++++++++++++++++++-------------- 8 files changed, 205 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 399918bca..70971501e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -677,6 +677,7 @@ dependencies = [ "actix-web 0.7.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 2de71e500..f56fc61f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ actix = "0.7" actix-web = "0.7" chrono = "0.4" dotenv = "0.13" +failure = "0.1" futures = "0.1" hashbrown = "0.1" serde = { version = "1.0", features = ["derive"] } diff --git a/src/api/client/room.rs b/src/api/client/room.rs index b695d2887..79268d8bd 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -5,13 +5,40 @@ use actix::prelude::*; use actix_web::ws::CloseReason; use futures::future::Future; use hashbrown::HashMap; +use serde::{Deserialize, Serialize}; use crate::{ api::client::{Close, WsSession}, api::control::{Id as MemberID, Member}, log::prelude::*, + media::{Id as PeerID, Peer, PeerMachine}, }; +use failure::Fail; + +#[derive(Fail, Debug)] +pub enum RoomError { + #[fail(display = "Unknown peer {}", _0)] + UnknownPeer(PeerID), + #[fail(display = "Unmatched state of peer {}", _0)] + UnmatchedState(PeerID), +} + +#[derive(Debug, Deserialize, Serialize, Message)] +#[rtype(result = "Result<(), RoomError>")] +pub enum Command { + MakeSdpOffer { peer_id: PeerID, sdp_offer: String }, + MakeSdpAnswer, +} + +#[derive(Debug, Deserialize, Serialize, Message)] +pub enum Event { + PeerCreated { + peer: PeerID, + sdp_offer: Option, + }, +} + /// ID of [`Room`]. pub type Id = u64; @@ -19,13 +46,49 @@ pub type Id = u64; #[derive(Clone, Debug)] pub struct Room { /// ID of [`Room`]. - pub id: Id, + id: Id, /// [`Member`]'s this room. - pub members: HashMap, + members: HashMap, /// [`WsSession`]s of [`Member`]'s this room. - pub sessions: HashMap>, + sessions: HashMap>, + + /// [`Peer`]s of [`Member`]'s this room. + peers: HashMap, +} + +impl Room { + pub fn new(id: Id, members: HashMap) -> Self { + Room { + id, + members, + sessions: HashMap::new(), + peers: HashMap::new(), + } + } + + fn start_pipeline(&mut self, members: (MemberID, MemberID)) { + let peer_responder_id = 2; + let peer_responder = + PeerMachine::New(Peer::new(peer_responder_id, members.1)); + let peer_caller_id = 1; + let peer_caller = PeerMachine::WaitLocalSDP( + Peer::new(peer_caller_id, members.0).start(peer_responder_id), + ); + let event = Event::PeerCreated { + peer: peer_caller_id, + sdp_offer: None, + }; + let caller_session = self.sessions.get(&members.0).unwrap(); + caller_session.do_send(event); + self.peers.insert(peer_caller_id, peer_caller); + self.peers.insert(peer_responder_id, peer_responder); + } +} + +impl Actor for Room { + type Context = Context; } /// Message for to get information about [`Member`] by its credentials. @@ -63,10 +126,15 @@ impl Handler for Room { /// before store current [`WsSession`] in [`Room`]. fn handle(&mut self, msg: JoinMember, _ctx: &mut Self::Context) { debug!("join member: {}", msg.0); + let mut reconnected = false; if let Some(old_session) = self.sessions.remove(&msg.0) { + reconnected = true; let _ = old_session.send(Close(None)).wait(); } self.sessions.insert(msg.0, msg.1); + if !reconnected && self.sessions.len() > 1 { + self.start_pipeline((1, 2)); + } } } @@ -87,8 +155,49 @@ impl Handler for Room { } } -impl Actor for Room { - type Context = Context; +impl Handler for Room { + type Result = Result<(), RoomError>; + + fn handle( + &mut self, + command: Command, + _ctx: &mut Self::Context, + ) -> Self::Result { + debug!("receive command: {:?}", command); + match command { + Command::MakeSdpOffer { peer_id, sdp_offer } => { + let peer_caller = self + .peers + .remove(&peer_id) + .ok_or(RoomError::UnknownPeer(peer_id))?; + let (new_peer_caller, opponent_peer_id) = match peer_caller { + PeerMachine::WaitLocalSDP(peer) => Ok(( + PeerMachine::WaitRemoteSDP( + peer.set_local_sdp(sdp_offer), + ), + peer.context.opponent_peer_id.unwrap(), + )), + _ => Err(RoomError::UnmatchedState(peer_id)), + }?; + self.peers.insert(peer_id, new_peer_caller); + let peer_responder = self + .peers + .remove(&opponent_peer_id) + .ok_or(RoomError::UnknownPeer(opponent_peer_id))?; + let new_peer_responder = match peer_responder { + PeerMachine::New(peer) => { + Ok(PeerMachine::WaitLocalHaveRemote( + peer.set_remote_sdp(sdp_offer), + )) + } + _ => Err(RoomError::UnmatchedState(opponent_peer_id)), + }?; + self.peers.insert(opponent_peer_id, new_peer_responder); + Ok(()) + } + _ => unimplemented!(), + } + } } /// Repository that stores [`Room`]s. diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 5ece0f892..51745ebfa 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -90,11 +90,7 @@ mod test { 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let room = Arbiter::start(move |_| Room { - id: 1, - members, - sessions: HashMap::new(), - }); + let room = Arbiter::start(move |_| Room::new(1, members)); let rooms = hashmap! {1 => room}; RoomsRepository::new(rooms) } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 6bf795b2d..cf7f4c2c8 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -7,7 +7,7 @@ use actix_web::ws::{self, CloseReason}; use serde::{Deserialize, Serialize}; use crate::{ - api::client::room::{JoinMember, LeaveMember, Room}, + api::client::room::{Event, JoinMember, LeaveMember, Room}, api::control::member::Id as MemberID, log::prelude::*, }; @@ -112,6 +112,15 @@ impl Handler for WsSession { } } +impl Handler for WsSession { + type Result = (); + + fn handle(&mut self, event: Event, ctx: &mut Self::Context) { + trace!("Send event: {:?}", event); + ctx.text(serde_json::to_string(&event).unwrap()) + } +} + impl StreamHandler for WsSession { /// Handles arbitrary [`ws::Message`] received from WebSocket client. fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { diff --git a/src/main.rs b/src/main.rs index ffcae5b10..2cbdff18d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,11 +25,7 @@ fn main() { 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; - let room = Arbiter::start(move |_| Room { - id: 1, - members, - sessions: HashMap::new(), - }); + let room = Arbiter::start(move |_| Room::new(1, members)); let rooms = hashmap! {1 => room}; let rooms_repo = RoomsRepository::new(rooms); diff --git a/src/media/mod.rs b/src/media/mod.rs index 00875fe22..af54a64bf 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -1,3 +1,3 @@ pub mod peer; -pub use self::peer::*; +pub use self::peer::{Id, Peer, PeerMachine}; diff --git a/src/media/peer.rs b/src/media/peer.rs index 67c90a41a..b6173d796 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -1,69 +1,101 @@ -use crate::{api::control::member, log::prelude::*}; +use crate::{api::control::member::Id as MemberID, log::prelude::*}; -#[derive(Debug, PartialEq)] -pub enum PeerMachine { - New(Peer), - WaitLocalSDP(Peer), - WaitLocalHaveRemote(Peer), - WaitRemoteSDP(Peer), - Stable(Peer), - Finished(Peer), - Failure, -} - -pub enum Command { - MakeSdpOffer, - MakeSdpAnswer -} +#[derive(Debug, Clone)] +pub struct New {} +#[derive(Debug, Clone)] +pub struct WaitLocalSDP {} +#[derive(Debug, Clone)] +pub struct WaitLocalHaveRemote {} +#[derive(Debug, Clone)] +pub struct WaitRemoteSDP {} +#[derive(Debug, Clone)] +pub struct Stable {} +#[derive(Debug, Clone)] +pub struct Finished {} +#[derive(Debug, Clone)] +pub struct Failure {} /// ID of [`Peer`]. pub type Id = u64; -#[derive(Debug, PartialEq)] -struct Peer { +#[derive(Debug, Clone)] +pub struct PeerContext { id: Id, - member_id: member::Id, + member_id: MemberID, + pub opponent_peer_id: Option, + offer: Option, } -impl PeerMachine { - pub fn new(id: Id, member_id: member::Id) -> Self { - PeerMachine::New(Peer{id, member_id}) +#[derive(Debug, Clone)] +pub struct Peer { + pub context: PeerContext, + state: S, +} + +#[derive(Debug, Clone)] +pub enum PeerMachine { + New(Peer), + WaitLocalSDP(Peer), + WaitLocalHaveRemote(Peer), + WaitRemoteSDP(Peer), + Stable(Peer), + Finished(Peer), + Failure(Peer), +} + +impl Peer { + pub fn new(id: Id, member_id: MemberID) -> Self { + let context = PeerContext { + id, + member_id, + opponent_peer_id: None, + offer: None, + }; + Peer { + context, + state: New {}, + } } - pub fn approve(self, c: Option) -> Self { - match (self, c) { - (PeerMachine::New(peer), None) => { - PeerMachine::WaitLocalSDP(peer) - }, - (PeerMachine::New(peer), Some(Command::MakeSdpOffer)) => { - PeerMachine::WaitLocalHaveRemote(peer) - }, - (PeerMachine::WaitLocalSDP(peer), Some(Command::MakeSdpOffer)) => { - PeerMachine::WaitRemoteSDP(peer) - }, - (PeerMachine::WaitLocalHaveRemote(peer), Some(Command::MakeSdpOffer)) => { - PeerMachine::WaitRemoteSDP(peer) - }, - _ => PeerMachine::Failure, + pub fn start(self, opponent_peer_id: Id) -> Peer { + let mut context = self.context; + context.opponent_peer_id = Some(opponent_peer_id); + Peer { + context, + state: WaitLocalSDP {}, } } - pub fn pool(&self) { - println!("{:?}", self) + pub fn set_remote_sdp(self, offer: String) -> Peer { + let mut context = self.context; + context.offer = Some(offer); + Peer { + context, + state: WaitLocalHaveRemote {}, + } + } +} + +impl Peer { + pub fn set_local_sdp(self, offer: String) -> Peer { + let mut context = self.context; + context.offer = Some(offer); + Peer { + context, + state: WaitRemoteSDP {}, + } } } #[cfg(test)] mod tests { use super::*; - use assert_matches::*; #[test] fn create_peer() { - let peer = PeerMachine::new(1, 1); - let peer = peer.approve(None); - peer.pool(); + let peer = Peer::new(1, 1); + let peer = peer.start(2); - assert_matches!(peer, PeerMachine::WaitLocalSDP(Peer{id: 1, member_id: 1})); + assert_eq!(peer.context.opponent_peer_id, Some(2)); } } From a71d5f382ed681b1ac1ff7cd8e5f7320e7b71421 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 25 Feb 2019 16:49:29 +0200 Subject: [PATCH 041/179] Simplify RpcConnection trait - fix close himself by external interface - add docs --- src/api/client/room.rs | 49 ++++++++++++++++---------------- src/api/client/server.rs | 51 ++++++++++++++++++++++++++------- src/api/client/session.rs | 59 ++++++++++++++------------------------- 3 files changed, 87 insertions(+), 72 deletions(-) diff --git a/src/api/client/room.rs b/src/api/client/room.rs index 817457e31..50018bea0 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -26,18 +26,22 @@ pub struct Room { pub connections: HashMap>, } +/// [`Actor`] implementation that provides an ergonomic way for members +/// to interact in [` Room`]. impl Actor for Room { type Context = Context; } +/// Connection of [`Member`]. pub trait RpcConnection: Debug + Send { - fn get_member_id(&self) -> Result>; - + /// Close connection. fn close(&self); } +/// Message that [`Member`] has connected to [`Room`]. #[derive(Message, Debug)] pub struct RpcConnectionEstablished { + pub member_id: MemberID, pub connection: Box, } @@ -48,15 +52,19 @@ pub struct GetMember { pub credentials: String, } +/// Message that [`Member`] closed or lost connection. #[derive(Message, Debug)] pub struct RpcConnectionClosed { pub member_id: MemberID, pub reason: RpcConnectionClosedReason, } +/// Reason closing connection of [`Member`]. #[derive(Debug)] pub enum RpcConnectionClosedReason { + /// [`Member`] closed connection himself. Disconnect, + /// [`Member`] has lost connection. Idle, } @@ -79,39 +87,32 @@ impl Handler for Room { impl Handler for Room { type Result = (); + /// Store connection of [`Member`] into [`Room`]. + /// + /// If the [`Member`] already has connection, it will be closed. fn handle( &mut self, msg: RpcConnectionEstablished, _ctx: &mut Self::Context, - ) -> Self::Result { - let member_id = msg.connection.get_member_id(); - - info!("RpcConnectionEstablished with member {:?}", &member_id); - - match member_id { - Ok(member_id) => { - if let Some(old_session) = self.connections.remove(&member_id) { - old_session.close(); - } - self.connections.insert(member_id, msg.connection); - } - Err(e) => { - error!("{:?}", e); - msg.connection.close(); - }, + ) { + info!("RpcConnectionEstablished with member {:?}", &msg.member_id); + if let Some(old_connection) = self.connections.remove(&msg.member_id) { + debug!("Reconnect WsSession for member {}", msg.member_id); + old_connection.close(); } + self.connections.insert(msg.member_id, msg.connection); } } impl Handler for Room { type Result = (); - fn handle( - &mut self, - msg: RpcConnectionClosed, - _ctx: &mut Self::Context, - ) -> Self::Result { - info!("RpcConnectionClosed with member {}, reason {:?}", &msg.member_id, msg.reason); + /// Remove connection of [`Member`] from [`Room`]. + fn handle(&mut self, msg: RpcConnectionClosed, _ctx: &mut Self::Context) { + info!( + "RpcConnectionClosed with member {}, reason {:?}", + &msg.member_id, msg.reason + ); self.connections.remove(&msg.member_id); } } diff --git a/src/api/client/server.rs b/src/api/client/server.rs index b66c5954e..511b95b73 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -133,18 +133,49 @@ mod test { let (reader, mut writer) = srv.ws_at("/ws/1/caller_credentials").unwrap(); + writer.text(r#"{"ping":33}"#); + let (item, reader) = srv.execute(reader.into_future()).unwrap(); + assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); + thread::sleep(session::CLIENT_IDLE_TIMEOUT.add(Duration::from_secs(1))); - writer.text(r#"{"ping":33}"#); - assert!(match srv.execute(reader.into_future()) { - Ok(( - Some(Close(Some(CloseReason { - code: CloseCode::Away, - description: None, - }))), - _, - )) => true, - _ => false, + let (item, _) = srv.execute(reader.into_future()).unwrap(); + assert_eq!( + item, + Some(ws::Message::Close(Some(ws::CloseCode::Normal.into()))) + ); + } + + #[test] + fn disconnects_on_reconnect() { + let mut srv = test::TestServer::with_factory(move || { + let repo = start_room(); + App::with_state(AppContext { rooms: repo }) + .resource("/ws/{room_id}/{credentials}", |r| { + r.method(http::Method::GET).with(ws_index) + }) }); + + let (reader, mut writer) = + srv.ws_at("/ws/1/caller_credentials").unwrap(); + writer.text(r#"{"ping":33}"#); + let (item, reader) = srv.execute(reader.into_future()).unwrap(); + assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); + + thread::sleep(Duration::from_secs(1)); + + let (reader2, mut writer2) = + srv.ws_at("/ws/1/caller_credentials").unwrap(); + writer2.text(r#"{"ping":33}"#); + let (item, _) = srv.execute(reader2.into_future()).unwrap(); + assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); + + thread::sleep(Duration::from_secs(1)); + + let (item, reader) = srv.execute(reader.into_future()).unwrap(); + assert_eq!( + item, + Some(ws::Message::Close(Some(ws::CloseCode::Restart.into()))) + ); } } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index df41a5e52..761be9527 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -4,14 +4,12 @@ use std::time::Duration; use actix::prelude::*; use actix_web::ws::{self, CloseReason}; -use failure::Fail; -use futures::future::Future; use serde::{Deserialize, Serialize}; use crate::{ api::client::room::{ - Room, RpcConnection, RpcConnectionClosed, RpcConnectionEstablished, - RpcConnectionClosedReason + Room, RpcConnection, RpcConnectionClosed, RpcConnectionClosedReason, + RpcConnectionEstablished, }, api::control::member::Id as MemberID, log::prelude::*, @@ -61,9 +59,11 @@ impl WsSession { info!("WsConnection with member {} is idle", member_id); session.room.do_send(RpcConnectionClosed { member_id: session.member_id, - reason: RpcConnectionClosedReason::Idle + reason: RpcConnectionClosedReason::Idle, + }); + ctx.notify(Close { + reason: Some(CloseCode::Normal.into()), }); - ctx.address().close(); })); } } @@ -78,34 +78,26 @@ impl Actor for WsSession { debug!("Started WsSession for member {}", self.member_id); self.reset_idle_timeout(ctx); self.room.do_send(RpcConnectionEstablished { + member_id: self.member_id, connection: Box::new(ctx.address()), }); } } impl RpcConnection for Addr { - fn get_member_id(&self) -> Result> { - self.send(GetMemberId {}) - .wait() - .map_err(|err: MailboxError| err.compat().into()) - } - + /// Close [`WsSession`] by send himself close message. fn close(&self) { + debug!("Reconnect WsSession"); self.do_send(Close { - close_frame: CloseReason::from(CloseCode::Normal), - }) + reason: Some(CloseCode::Normal.into()), + }); } } -/// Message sending from [`Room`] for closing [`WsSession`]. -#[derive(Message)] -#[rtype(result = "MemberID")] -pub struct GetMemberId(); - -/// Message sending from [`Room`] for closing [`WsSession`]. +/// Message for closing [`WsSession`]. #[derive(Message)] pub struct Close { - close_frame: CloseReason, + reason: Option, } /// Message for keeping client WebSocket connection alive. @@ -121,25 +113,13 @@ pub enum Heartbeat { Pong(usize), } -impl Handler for WsSession { - type Result = MemberID; - - fn handle( - &mut self, - _msg: GetMemberId, - _ctx: &mut Self::Context, - ) -> Self::Result { - self.member_id - } -} - impl Handler for WsSession { type Result = (); /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. fn handle(&mut self, close: Close, ctx: &mut Self::Context) { debug!("Closing WsSession for member {}", self.member_id); - ctx.close(Some(close.close_frame)); + ctx.close(close.reason); ctx.stop(); } } @@ -160,7 +140,10 @@ impl Handler for WsSession { impl StreamHandler for WsSession { /// Handles arbitrary [`ws::Message`] received from WebSocket client. fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { - debug!("Received WS message: {:?} from member {}", msg, self.member_id); + debug!( + "Received WS message: {:?} from member {}", + msg, self.member_id + ); match msg { ws::Message::Text(text) => { self.reset_idle_timeout(ctx); @@ -168,12 +151,12 @@ impl StreamHandler for WsSession { ctx.notify(msg); } } - ws::Message::Close(_reason) => { + ws::Message::Close(reason) => { self.room.do_send(RpcConnectionClosed { member_id: self.member_id, - reason: RpcConnectionClosedReason::Disconnect + reason: RpcConnectionClosedReason::Disconnect, }); - ctx.stop(); + ctx.notify(Close { reason }); } _ => error!("Unsupported message from member {}", self.member_id), } From 261ed38de1d00a7bb3635b1df78a2bc73e55c26e Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 26 Feb 2019 16:38:30 +0200 Subject: [PATCH 042/179] Impl correct close WsSession --- src/api/client/server.rs | 3 +-- src/api/client/session.rs | 40 ++++++++++++++++++++++++--------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 511b95b73..dc4fcf128 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -78,7 +78,7 @@ mod test { use std::{ops::Add, thread, time::Duration}; use actix::prelude::*; - use actix_web::{http, test, ws::CloseReason, ws::Message::Close, App}; + use actix_web::{http, test, App}; use futures::Stream; use hashbrown::HashMap; @@ -88,7 +88,6 @@ mod test { }; use super::*; - use actix_web::ws::CloseCode; fn start_room() -> RoomsRepository { let members = hashmap! { diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 761be9527..7e1c4b8ec 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -35,6 +35,8 @@ pub struct WsSession { /// This one should be renewed on any received WebSocket message /// from client. idle_handler: Option, + + closed_by_server: bool, } impl WsSession { @@ -44,6 +46,7 @@ impl WsSession { member_id, room, idle_handler: None, + closed_by_server: false, } } @@ -57,13 +60,13 @@ impl WsSession { self.idle_handler = Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, move |session, ctx| { info!("WsConnection with member {} is idle", member_id); + ctx.notify(Close { + reason: Some(CloseCode::Normal.into()), + }); session.room.do_send(RpcConnectionClosed { member_id: session.member_id, reason: RpcConnectionClosedReason::Idle, }); - ctx.notify(Close { - reason: Some(CloseCode::Normal.into()), - }); })); } } @@ -82,6 +85,10 @@ impl Actor for WsSession { connection: Box::new(ctx.address()), }); } + + fn stopped(&mut self, _ctx: &mut Self::Context) { + debug!("Stopped WsSession for member {}", self.member_id); + } } impl RpcConnection for Addr { @@ -100,6 +107,17 @@ pub struct Close { reason: Option, } +impl Handler for WsSession { + type Result = (); + + /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. + fn handle(&mut self, close: Close, ctx: &mut Self::Context) { + debug!("Closing WsSession for member {}", self.member_id); + self.closed_by_server = true; + ctx.close(close.reason); + } +} + /// Message for keeping client WebSocket connection alive. #[derive(Debug, Message, Deserialize, Serialize)] pub enum Heartbeat { @@ -113,17 +131,6 @@ pub enum Heartbeat { Pong(usize), } -impl Handler for WsSession { - type Result = (); - - /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. - fn handle(&mut self, close: Close, ctx: &mut Self::Context) { - debug!("Closing WsSession for member {}", self.member_id); - ctx.close(close.reason); - ctx.stop(); - } -} - impl Handler for WsSession { type Result = (); @@ -152,11 +159,14 @@ impl StreamHandler for WsSession { } } ws::Message::Close(reason) => { + if !self.closed_by_server { + debug!("Send close frame with reason {:?}", reason); + ctx.close(reason); + } self.room.do_send(RpcConnectionClosed { member_id: self.member_id, reason: RpcConnectionClosedReason::Disconnect, }); - ctx.notify(Close { reason }); } _ => error!("Unsupported message from member {}", self.member_id), } From 0470201099ac55ecc9d0507bdc78c82d73cd897b Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 27 Feb 2019 13:56:15 +0200 Subject: [PATCH 043/179] Fix send close message to Room --- src/api/client/room.rs | 6 +++--- src/api/client/server.rs | 33 --------------------------------- src/api/client/session.rs | 10 ++++++---- 3 files changed, 9 insertions(+), 40 deletions(-) diff --git a/src/api/client/room.rs b/src/api/client/room.rs index 50018bea0..3ad7ffb85 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -59,12 +59,12 @@ pub struct RpcConnectionClosed { pub reason: RpcConnectionClosedReason, } -/// Reason closing connection of [`Member`]. +/// [`RpcConnection`] close reasons. #[derive(Debug)] pub enum RpcConnectionClosedReason { - /// [`Member`] closed connection himself. + /// [`RpcConnection`] gracefully disconnected from server. Disconnect, - /// [`Member`] has lost connection. + /// [`RpcConnection`] was considered idle. Idle, } diff --git a/src/api/client/server.rs b/src/api/client/server.rs index dc4fcf128..c89153753 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -144,37 +144,4 @@ mod test { Some(ws::Message::Close(Some(ws::CloseCode::Normal.into()))) ); } - - #[test] - fn disconnects_on_reconnect() { - let mut srv = test::TestServer::with_factory(move || { - let repo = start_room(); - App::with_state(AppContext { rooms: repo }) - .resource("/ws/{room_id}/{credentials}", |r| { - r.method(http::Method::GET).with(ws_index) - }) - }); - - let (reader, mut writer) = - srv.ws_at("/ws/1/caller_credentials").unwrap(); - writer.text(r#"{"ping":33}"#); - let (item, reader) = srv.execute(reader.into_future()).unwrap(); - assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); - - thread::sleep(Duration::from_secs(1)); - - let (reader2, mut writer2) = - srv.ws_at("/ws/1/caller_credentials").unwrap(); - writer2.text(r#"{"ping":33}"#); - let (item, _) = srv.execute(reader2.into_future()).unwrap(); - assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.to_owned()))); - - thread::sleep(Duration::from_secs(1)); - - let (item, reader) = srv.execute(reader.into_future()).unwrap(); - assert_eq!( - item, - Some(ws::Message::Close(Some(ws::CloseCode::Restart.into()))) - ); - } } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 7e1c4b8ec..d2628fa10 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -115,6 +115,7 @@ impl Handler for WsSession { debug!("Closing WsSession for member {}", self.member_id); self.closed_by_server = true; ctx.close(close.reason); + ctx.stop(); } } @@ -160,13 +161,14 @@ impl StreamHandler for WsSession { } ws::Message::Close(reason) => { if !self.closed_by_server { + self.room.do_send(RpcConnectionClosed { + member_id: self.member_id, + reason: RpcConnectionClosedReason::Disconnect, + }); debug!("Send close frame with reason {:?}", reason); ctx.close(reason); + ctx.stop(); } - self.room.do_send(RpcConnectionClosed { - member_id: self.member_id, - reason: RpcConnectionClosedReason::Disconnect, - }); } _ => error!("Unsupported message from member {}", self.member_id), } From 55b9c3e7d9068a8aaff6ad8f01ed70ddd36b25f6 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 1 Mar 2019 13:55:11 +0200 Subject: [PATCH 044/179] Impl crate offers for caller and responder --- Cargo.toml | 1 - README.md | 2 + src/api/client/room.rs | 145 ++++++++++++++++++++++++++++---------- src/api/client/server.rs | 1 - src/api/client/session.rs | 33 +++++++-- src/main.rs | 1 - src/media/peer.rs | 10 +-- 7 files changed, 143 insertions(+), 50 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b6e2c4984..f56fc61f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,4 +25,3 @@ slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" -failure = "0.1.5" diff --git a/README.md b/README.md index e376bfacf..95216614a 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,5 @@ Medea Medea media server __DEVELOPMENT IN PROGRESS__ + +{"MakeSdpOffer":{"peer":0,"sdp_offer":"caller_offer"}} diff --git a/src/api/client/room.rs b/src/api/client/room.rs index 94ea5eab2..b0478ef92 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -14,8 +14,15 @@ use std::fmt::Debug; use failure::Fail; +const PEER_CALLER_ID: PeerID = 1; +const PEER_RESPONDER_ID: PeerID = 2; + #[derive(Fail, Debug)] pub enum RoomError { + #[fail(display = "Member without peer {}", _0)] + MemberWithoutPeer(MemberID), + #[fail(display = "Invalid connection of member {}", _0)] + InvalidConnection(MemberID), #[fail(display = "Unknown peer {}", _0)] UnknownPeer(PeerID), #[fail(display = "Unmatched state of peer {}", _0)] @@ -23,7 +30,7 @@ pub enum RoomError { } #[derive(Debug, Deserialize, Serialize, Message)] -#[rtype(result = "Result<(), RoomError>")] +#[rtype(result = "Result")] pub enum Command { MakeSdpOffer { peer_id: PeerID, sdp_offer: String }, MakeSdpAnswer, @@ -32,7 +39,7 @@ pub enum Command { #[derive(Debug, Deserialize, Serialize, Message)] pub enum Event { PeerCreated { - peer: PeerID, + peer_id: PeerID, sdp_offer: Option, }, } @@ -52,8 +59,12 @@ pub struct Room { /// Connections of [`Member`]'s this room. connections: HashMap>, + member_peers: HashMap, + /// [`Peer`]s of [`Member`]'s this room. peers: HashMap, + + peer_index: u64, } /// [`Actor`] implementation that provides an ergonomic way for members @@ -66,10 +77,14 @@ impl Actor for Room { pub trait RpcConnection: Debug + Send { /// Close connection. fn close(&self); + + /// Send event. + fn send_event(&self, event: Event); } /// Message that [`Member`] has connected to [`Room`]. #[derive(Message, Debug)] +#[rtype(result = "Result<(), RoomError>")] pub struct RpcConnectionEstablished { pub member_id: MemberID, pub connection: Box, @@ -81,26 +96,52 @@ impl Room { id, members, connections: HashMap::new(), + member_peers: HashMap::new(), peers: HashMap::new(), + peer_index: 0, } } - fn start_pipeline(&mut self, members: (MemberID, MemberID)) { - let peer_responder_id = 2; - let peer_responder = - PeerMachine::New(Peer::new(peer_responder_id, members.1)); - let peer_caller_id = 1; - let peer_caller = PeerMachine::WaitLocalSDP( - Peer::new(peer_caller_id, members.0).start(peer_responder_id), - ); + fn next_peer_id(&mut self) -> PeerID { + let id = self.peer_index; + self.peer_index += 1; + id + } + + fn start_pipeline( + &mut self, + caller: MemberID, + responder: MemberID, + ) -> Result<(), RoomError> { + let peer_caller_id = self + .member_peers + .get(&caller) + .ok_or(RoomError::MemberWithoutPeer(caller))?; + let peer_responder_id = self + .member_peers + .get(&responder) + .ok_or(RoomError::MemberWithoutPeer(responder))?; + let peer_caller = self + .peers + .remove(peer_caller_id) + .ok_or(RoomError::UnknownPeer(*peer_caller_id))?; + let new_peer_caller = match peer_caller { + PeerMachine::New(peer) => { + Ok(PeerMachine::WaitLocalSDP(peer.start(*peer_responder_id))) + } + _ => Err(RoomError::UnmatchedState(*peer_caller_id)), + }?; let event = Event::PeerCreated { - peer: peer_caller_id, + peer_id: *peer_caller_id, sdp_offer: None, }; - let caller_session = self.sessions.get(&members.0).unwrap(); - caller_session.do_send(event); - self.peers.insert(peer_caller_id, peer_caller); - self.peers.insert(peer_responder_id, peer_responder); + let caller_connection = self + .connections + .get(&caller) + .ok_or(RoomError::InvalidConnection(caller))?; + caller_connection.send_event(event); + self.peers.insert(*peer_caller_id, new_peer_caller); + Ok(()) } } @@ -144,7 +185,7 @@ impl Handler for Room { } impl Handler for Room { - type Result = (); + type Result = Result<(), RoomError>; /// Store connection of [`Member`] into [`Room`]. /// @@ -153,17 +194,26 @@ impl Handler for Room { &mut self, msg: RpcConnectionEstablished, _ctx: &mut Self::Context, - ) { + ) -> Self::Result { info!("RpcConnectionEstablished with member {:?}", &msg.member_id); + let mut reconnected = false; if let Some(old_connection) = self.connections.remove(&msg.member_id) { reconnected = true; debug!("Reconnect WsSession for member {}", msg.member_id); old_connection.close(); } self.connections.insert(msg.member_id, msg.connection); - if !reconnected && self.connections.len() > 1 { - self.start_pipeline((1, 2)); + if !reconnected { + let peer_id = self.next_peer_id(); + let peer = PeerMachine::New(Peer::new(peer_id, msg.member_id)); + self.peers.insert(peer_id, peer); + self.member_peers.insert(msg.member_id, peer_id); + + if self.connections.len() > 1 { + self.start_pipeline(1, 2)?; + } } + Ok(()) } } @@ -181,7 +231,7 @@ impl Handler for Room { } impl Handler for Room { - type Result = Result<(), RoomError>; + type Result = Result; fn handle( &mut self, @@ -195,30 +245,53 @@ impl Handler for Room { .peers .remove(&peer_id) .ok_or(RoomError::UnknownPeer(peer_id))?; - let (new_peer_caller, opponent_peer_id) = match peer_caller { - PeerMachine::WaitLocalSDP(peer) => Ok(( - PeerMachine::WaitRemoteSDP( - peer.set_local_sdp(sdp_offer), - ), - peer.context.opponent_peer_id.unwrap(), - )), - _ => Err(RoomError::UnmatchedState(peer_id)), + let (new_peer_caller, responder_peer_id) = match peer_caller { + PeerMachine::WaitLocalSDP(peer) => { + let opponent_peer_id = + peer.context.opponent_peer_id.unwrap(); + Ok(( + PeerMachine::WaitRemoteSDP( + peer.set_local_sdp(&sdp_offer), + ), + opponent_peer_id, + )) + } + _ => { + error!("Unmatched state caller peer"); + Err(RoomError::UnmatchedState(peer_id)) + } }?; self.peers.insert(peer_id, new_peer_caller); let peer_responder = self .peers - .remove(&opponent_peer_id) - .ok_or(RoomError::UnknownPeer(opponent_peer_id))?; - let new_peer_responder = match peer_responder { + .remove(&responder_peer_id) + .ok_or(RoomError::UnknownPeer(responder_peer_id))?; + let (new_peer_responder, responder_id) = match peer_responder { PeerMachine::New(peer) => { - Ok(PeerMachine::WaitLocalHaveRemote( - peer.set_remote_sdp(sdp_offer), + let member_id = peer.context.member_id; + Ok(( + PeerMachine::WaitLocalHaveRemote( + peer.set_remote_sdp(&sdp_offer), + ), + member_id, )) } - _ => Err(RoomError::UnmatchedState(opponent_peer_id)), + _ => { + error!("Unmatched state responder peer"); + Err(RoomError::UnmatchedState(responder_peer_id)) + } }?; - self.peers.insert(opponent_peer_id, new_peer_responder); - Ok(()) + self.peers.insert(responder_peer_id, new_peer_responder); + let event = Event::PeerCreated { + peer_id: responder_peer_id, + sdp_offer: Some(sdp_offer), + }; + let responder_connection = self + .connections + .get(&responder_id) + .ok_or(RoomError::InvalidConnection(responder_id))?; + responder_connection.send_event(event); + Ok(true) } _ => unimplemented!(), } diff --git a/src/api/client/server.rs b/src/api/client/server.rs index dfaf9a313..4990e0274 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -80,7 +80,6 @@ mod test { use actix::prelude::*; use actix_web::{http, test, App}; use futures::Stream; - use hashbrown::HashMap; use crate::api::{ client::{session, Room}, diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 87711f7e8..87c2154b1 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -8,8 +8,8 @@ use serde::{Deserialize, Serialize}; use crate::{ api::client::room::{ - Event, Room, RpcConnection, RpcConnectionClosed, RpcConnectionClosedReason, - RpcConnectionEstablished, + Command, Event, Room, RpcConnection, RpcConnectionClosed, + RpcConnectionClosedReason, RpcConnectionEstablished, }, api::control::member::Id as MemberID, log::prelude::*, @@ -80,10 +80,17 @@ impl Actor for WsSession { fn started(&mut self, ctx: &mut Self::Context) { debug!("Started WsSession for member {}", self.member_id); self.reset_idle_timeout(ctx); - self.room.do_send(RpcConnectionEstablished { - member_id: self.member_id, - connection: Box::new(ctx.address()), - }); + self.room + .send(RpcConnectionEstablished { + member_id: self.member_id, + connection: Box::new(ctx.address()), + }) + .into_actor(self) + .then(|r, a, c| { + debug!("{:?}", r); + fut::ok::<(), (), Self>(()) + }) + .wait(ctx); } fn stopped(&mut self, _ctx: &mut Self::Context) { @@ -99,6 +106,10 @@ impl RpcConnection for Addr { reason: Some(CloseCode::Normal.into()), }); } + + fn send_event(&self, event: Event) { + self.do_send(event); + } } /// Message for closing [`WsSession`]. @@ -167,6 +178,16 @@ impl StreamHandler for WsSession { if let Ok(msg) = serde_json::from_str::(&text) { ctx.notify(msg); } + if let Ok(command) = serde_json::from_str::(&text) { + self.room + .send(command) + .into_actor(self) + .then(|r, a, c| { + debug!("{:?}", r); + fut::ok::<(), (), Self>(()) + }) + .wait(ctx); + } } ws::Message::Close(reason) => { if !self.closed_by_server { diff --git a/src/main.rs b/src/main.rs index 2cbdff18d..e638e9a09 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,6 @@ //! Medea media server application. use actix::prelude::*; use dotenv::dotenv; -use hashbrown::HashMap; use crate::api::client::{server, Room, RoomsRepository}; use crate::api::control::Member; diff --git a/src/media/peer.rs b/src/media/peer.rs index b6173d796..452abb817 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -21,7 +21,7 @@ pub type Id = u64; #[derive(Debug, Clone)] pub struct PeerContext { id: Id, - member_id: MemberID, + pub member_id: MemberID, pub opponent_peer_id: Option, offer: Option, } @@ -66,9 +66,9 @@ impl Peer { } } - pub fn set_remote_sdp(self, offer: String) -> Peer { + pub fn set_remote_sdp(self, offer: &str) -> Peer { let mut context = self.context; - context.offer = Some(offer); + context.offer = Some(offer.into()); Peer { context, state: WaitLocalHaveRemote {}, @@ -77,9 +77,9 @@ impl Peer { } impl Peer { - pub fn set_local_sdp(self, offer: String) -> Peer { + pub fn set_local_sdp(self, offer: &str) -> Peer { let mut context = self.context; - context.offer = Some(offer); + context.offer = Some(offer.into()); Peer { context, state: WaitRemoteSDP {}, From 4703bd3cc257c7a944d6efe56eb4d8b375a4ecea Mon Sep 17 00:00:00 2001 From: Kirguir Date: Mon, 4 Mar 2019 16:47:22 +0200 Subject: [PATCH 045/179] Impl receive sdp_answer and send it to caller --- Cargo.lock | 1 + Cargo.toml | 3 + src/api/client/room.rs | 240 ++++++++++++++++++++++++++++++-------- src/api/client/session.rs | 4 +- src/media/peer.rs | 78 ++++++++++--- 5 files changed, 260 insertions(+), 66 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70971501e..005af8791 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -688,6 +688,7 @@ dependencies = [ "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f56fc61f2..e1e8404c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,3 +25,6 @@ slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" + +[dev-dependencies] +tokio = "0.1" diff --git a/src/api/client/room.rs b/src/api/client/room.rs index b0478ef92..fc29f4a9a 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -14,9 +14,6 @@ use std::fmt::Debug; use failure::Fail; -const PEER_CALLER_ID: PeerID = 1; -const PEER_RESPONDER_ID: PeerID = 2; - #[derive(Fail, Debug)] pub enum RoomError { #[fail(display = "Member without peer {}", _0)] @@ -25,6 +22,8 @@ pub enum RoomError { InvalidConnection(MemberID), #[fail(display = "Unknown peer {}", _0)] UnknownPeer(PeerID), + #[fail(display = "Peer dont have opponent {}", _0)] + NoOpponentPeer(PeerID), #[fail(display = "Unmatched state of peer {}", _0)] UnmatchedState(PeerID), } @@ -33,7 +32,7 @@ pub enum RoomError { #[rtype(result = "Result")] pub enum Command { MakeSdpOffer { peer_id: PeerID, sdp_offer: String }, - MakeSdpAnswer, + MakeSdpAnswer { peer_id: PeerID, sdp_answer: String }, } #[derive(Debug, Deserialize, Serialize, Message)] @@ -42,6 +41,10 @@ pub enum Event { peer_id: PeerID, sdp_offer: Option, }, + SdpAnswerMade { + peer_id: PeerID, + sdp_answer: String, + }, } /// ID of [`Room`]. @@ -61,6 +64,8 @@ pub struct Room { member_peers: HashMap, + peer_to_peer: HashMap, + /// [`Peer`]s of [`Member`]'s this room. peers: HashMap, @@ -98,6 +103,7 @@ impl Room { connections: HashMap::new(), member_peers: HashMap::new(), peers: HashMap::new(), + peer_to_peer: HashMap::new(), peer_index: 0, } } @@ -116,31 +122,33 @@ impl Room { let peer_caller_id = self .member_peers .get(&caller) + .map(|id| *id) .ok_or(RoomError::MemberWithoutPeer(caller))?; let peer_responder_id = self .member_peers .get(&responder) + .map(|id| *id) .ok_or(RoomError::MemberWithoutPeer(responder))?; + self.peer_to_peer.insert(peer_caller_id, peer_responder_id); + self.peer_to_peer.insert(peer_responder_id, peer_caller_id); let peer_caller = self .peers - .remove(peer_caller_id) - .ok_or(RoomError::UnknownPeer(*peer_caller_id))?; + .remove(&peer_caller_id) + .ok_or(RoomError::UnknownPeer(peer_caller_id))?; let new_peer_caller = match peer_caller { PeerMachine::New(peer) => { - Ok(PeerMachine::WaitLocalSDP(peer.start(*peer_responder_id))) + Ok(PeerMachine::WaitLocalSDP(peer.start(|member_id| { + let connection = self.connections.get(&member_id).unwrap(); + let event = Event::PeerCreated { + peer_id: peer_caller_id, + sdp_offer: None, + }; + connection.send_event(event); + }))) } - _ => Err(RoomError::UnmatchedState(*peer_caller_id)), + _ => Err(RoomError::UnmatchedState(peer_caller_id)), }?; - let event = Event::PeerCreated { - peer_id: *peer_caller_id, - sdp_offer: None, - }; - let caller_connection = self - .connections - .get(&caller) - .ok_or(RoomError::InvalidConnection(caller))?; - caller_connection.send_event(event); - self.peers.insert(*peer_caller_id, new_peer_caller); + self.peers.insert(peer_caller_id, new_peer_caller); Ok(()) } } @@ -245,15 +253,10 @@ impl Handler for Room { .peers .remove(&peer_id) .ok_or(RoomError::UnknownPeer(peer_id))?; - let (new_peer_caller, responder_peer_id) = match peer_caller { + let new_peer_caller = match peer_caller { PeerMachine::WaitLocalSDP(peer) => { - let opponent_peer_id = - peer.context.opponent_peer_id.unwrap(); - Ok(( - PeerMachine::WaitRemoteSDP( - peer.set_local_sdp(&sdp_offer), - ), - opponent_peer_id, + Ok(PeerMachine::WaitRemoteSDP( + peer.set_local_sdp(sdp_offer.clone()), )) } _ => { @@ -262,38 +265,90 @@ impl Handler for Room { } }?; self.peers.insert(peer_id, new_peer_caller); + + let responder_peer_id = self + .peer_to_peer + .get(&peer_id) + .map(|&id| id) + .ok_or(RoomError::NoOpponentPeer(peer_id))?; let peer_responder = self .peers .remove(&responder_peer_id) .ok_or(RoomError::UnknownPeer(responder_peer_id))?; - let (new_peer_responder, responder_id) = match peer_responder { - PeerMachine::New(peer) => { - let member_id = peer.context.member_id; - Ok(( - PeerMachine::WaitLocalHaveRemote( - peer.set_remote_sdp(&sdp_offer), - ), - member_id, - )) - } + let new_peer_responder = match peer_responder { + PeerMachine::New(peer) => Ok( + PeerMachine::WaitLocalHaveRemote(peer.set_remote_sdp( + sdp_offer, + |peer_id, member_id, sdp_offer| { + let connection = + self.connections.get(&member_id).unwrap(); + let event = Event::PeerCreated { + peer_id, + sdp_offer: Some(sdp_offer), + }; + connection.send_event(event); + }, + )), + ), _ => { error!("Unmatched state responder peer"); Err(RoomError::UnmatchedState(responder_peer_id)) } }?; self.peers.insert(responder_peer_id, new_peer_responder); - let event = Event::PeerCreated { - peer_id: responder_peer_id, - sdp_offer: Some(sdp_offer), - }; - let responder_connection = self - .connections - .get(&responder_id) - .ok_or(RoomError::InvalidConnection(responder_id))?; - responder_connection.send_event(event); Ok(true) } - _ => unimplemented!(), + Command::MakeSdpAnswer { + peer_id, + sdp_answer, + } => { + let peer_responder = self + .peers + .remove(&peer_id) + .ok_or(RoomError::UnknownPeer(peer_id))?; + let new_peer_responder = match peer_responder { + PeerMachine::WaitLocalHaveRemote(peer) => { + Ok(PeerMachine::Stable( + peer.set_local_sdp(sdp_answer.clone()), + )) + } + _ => { + error!("Unmatched state caller peer"); + Err(RoomError::UnmatchedState(peer_id)) + } + }?; + self.peers.insert(peer_id, new_peer_responder); + + let caller_peer_id = self + .peer_to_peer + .get(&peer_id) + .map(|&id| id) + .ok_or(RoomError::NoOpponentPeer(peer_id))?; + let peer_caller = self + .peers + .remove(&caller_peer_id) + .ok_or(RoomError::UnknownPeer(caller_peer_id))?; + let new_peer_caller = match peer_caller { + PeerMachine::WaitRemoteSDP(peer) => { + Ok(PeerMachine::Stable(peer.set_remote_sdp( + sdp_answer, + |peer_id, member_id, sdp_answer| { + let connection = + self.connections.get(&member_id).unwrap(); + let event = Event::SdpAnswerMade { + peer_id, + sdp_answer, + }; + connection.send_event(event); + }, + ))) + } + _ => Err(RoomError::UnmatchedState(caller_peer_id)), + }?; + self.peers.insert(caller_peer_id, new_peer_caller); + + Ok(true) + } } } } @@ -318,3 +373,96 @@ impl RoomsRepository { rooms.get(&id).map(|r| r.clone()) } } + +#[cfg(test)] +mod test { + use std::sync::atomic::{AtomicUsize, Ordering}; + use std::time::{Duration, Instant}; + + use futures::future::{result, Future}; + use tokio::timer::Delay; + + use super::*; + + #[derive(Debug, Clone)] + struct TestConnection { + pub room: Addr, + pub count_events: Arc, + } + + impl RpcConnection for TestConnection { + fn close(&self) {} + + fn send_event(&self, event: Event) { + self.count_events.store( + self.count_events.load(Ordering::Relaxed) + 1, + Ordering::Relaxed, + ); + match event { + Event::PeerCreated { peer_id, sdp_offer } => match sdp_offer { + Some(_) => self.room.do_send(Command::MakeSdpAnswer { + peer_id, + sdp_answer: "responder_answer".into(), + }), + None => self.room.do_send(Command::MakeSdpOffer { + peer_id, + sdp_offer: "caller_offer".into(), + }), + }, + Event::SdpAnswerMade { + peer_id: _, + sdp_answer: _, + } => {} + } + } + } + + fn start_room() -> Addr { + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + Arbiter::start(move |_| Room::new(1, members)) + } + + #[test] + fn start_signaling() { + let caller_event = Arc::new(AtomicUsize::new(0)); + let caller_event_clone = Arc::clone(&caller_event); + let responder_event = Arc::new(AtomicUsize::new(0)); + let responder_event_clone = Arc::clone(&responder_event); + + System::run(move || { + let room = start_room(); + let caller = TestConnection { + room: room.clone(), + count_events: caller_event_clone, + }; + let responder = TestConnection { + room: room.clone(), + count_events: responder_event_clone, + }; + let caller_message = RpcConnectionEstablished { + member_id: 1, + connection: Box::new(caller), + }; + let responder_message = RpcConnectionEstablished { + member_id: 2, + connection: Box::new(responder), + }; + room.do_send(caller_message); + + tokio::spawn(room.send(responder_message).then(move |_| { + Delay::new(Instant::now() + Duration::new(0, 1_000_000)).then( + move |_| { + System::current().stop(); + result(Ok(())) + }, + ) + })); + }); + + assert_eq!(caller_event.load(Ordering::Relaxed), 2); + assert_eq!(responder_event.load(Ordering::Relaxed), 1); + } +} diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 87c2154b1..966448c4b 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -86,7 +86,7 @@ impl Actor for WsSession { connection: Box::new(ctx.address()), }) .into_actor(self) - .then(|r, a, c| { + .then(|r, _a, _c| { debug!("{:?}", r); fut::ok::<(), (), Self>(()) }) @@ -182,7 +182,7 @@ impl StreamHandler for WsSession { self.room .send(command) .into_actor(self) - .then(|r, a, c| { + .then(|r, _a, _c| { debug!("{:?}", r); fut::ok::<(), (), Self>(()) }) diff --git a/src/media/peer.rs b/src/media/peer.rs index 452abb817..5024eb547 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -1,4 +1,4 @@ -use crate::{api::control::member::Id as MemberID, log::prelude::*}; +use crate::api::control::member::Id as MemberID; #[derive(Debug, Clone)] pub struct New {} @@ -18,17 +18,17 @@ pub struct Failure {} /// ID of [`Peer`]. pub type Id = u64; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct PeerContext { id: Id, - pub member_id: MemberID, - pub opponent_peer_id: Option, - offer: Option, + member_id: MemberID, + sdp_offer: Option, + sdp_answer: Option, } #[derive(Debug, Clone)] pub struct Peer { - pub context: PeerContext, + context: PeerContext, state: S, } @@ -48,8 +48,8 @@ impl Peer { let context = PeerContext { id, member_id, - opponent_peer_id: None, - offer: None, + sdp_offer: None, + sdp_answer: None, }; Peer { context, @@ -57,18 +57,25 @@ impl Peer { } } - pub fn start(self, opponent_peer_id: Id) -> Peer { - let mut context = self.context; - context.opponent_peer_id = Some(opponent_peer_id); + pub fn start( + self, + success: impl FnOnce(MemberID) -> (), + ) -> Peer { + success(self.context.member_id); Peer { - context, + context: self.context, state: WaitLocalSDP {}, } } - pub fn set_remote_sdp(self, offer: &str) -> Peer { + pub fn set_remote_sdp( + self, + sdp_offer: String, + success: impl Fn(Id, MemberID, String) -> (), + ) -> Peer { let mut context = self.context; - context.offer = Some(offer.into()); + context.sdp_offer = Some(sdp_offer.clone()); + success(context.id, context.member_id, sdp_offer); Peer { context, state: WaitLocalHaveRemote {}, @@ -77,9 +84,9 @@ impl Peer { } impl Peer { - pub fn set_local_sdp(self, offer: &str) -> Peer { + pub fn set_local_sdp(self, sdp_offer: String) -> Peer { let mut context = self.context; - context.offer = Some(offer.into()); + context.sdp_offer = Some(sdp_offer); Peer { context, state: WaitRemoteSDP {}, @@ -87,6 +94,33 @@ impl Peer { } } +impl Peer { + pub fn set_remote_sdp( + self, + sdp_answer: String, + success: impl Fn(Id, MemberID, String) -> (), + ) -> Peer { + let mut context = self.context; + context.sdp_answer = Some(sdp_answer.clone()); + success(context.id, context.member_id, sdp_answer); + Peer { + context, + state: Stable {}, + } + } +} + +impl Peer { + pub fn set_local_sdp(self, sdp_answer: String) -> Peer { + let mut context = self.context; + context.sdp_answer = Some(sdp_answer); + Peer { + context, + state: Stable {}, + } + } +} + #[cfg(test)] mod tests { use super::*; @@ -94,8 +128,16 @@ mod tests { #[test] fn create_peer() { let peer = Peer::new(1, 1); - let peer = peer.start(2); + let peer = peer.start(|_| {}); - assert_eq!(peer.context.opponent_peer_id, Some(2)); + assert_eq!( + peer.context, + PeerContext { + id: 1, + member_id: 1, + sdp_offer: None, + sdp_answer: None + } + ); } } From 6687b87b207168ecaa955c0a4aec83da50dd6902 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 7 Mar 2019 14:35:11 +0200 Subject: [PATCH 046/179] Impl create tracks and store link into peers --- src/api/client/room.rs | 146 +++++++++++++++++++++++++++-------------- src/media/errors.rs | 7 ++ src/media/mod.rs | 8 ++- src/media/peer.rs | 102 ++++++++++++++++------------ src/media/track.rs | 27 ++++++++ 5 files changed, 198 insertions(+), 92 deletions(-) create mode 100644 src/media/errors.rs create mode 100644 src/media/track.rs diff --git a/src/api/client/room.rs b/src/api/client/room.rs index fc29f4a9a..12af5d261 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -8,7 +8,12 @@ use serde::{Deserialize, Serialize}; use crate::{ api::control::{Id as MemberID, Member}, log::prelude::*, - media::{Id as PeerID, Peer, PeerMachine}, + media::{ + peer::{Id as PeerID, Peer, PeerMachine}, + track::{ + AudioSettings, Id as TrackID, Track, TrackMediaType, VideoSettings, + }, + }, }; use std::fmt::Debug; @@ -28,23 +33,28 @@ pub enum RoomError { UnmatchedState(PeerID), } +/// WebSocket message from Web Client to Media Server. #[derive(Debug, Deserialize, Serialize, Message)] #[rtype(result = "Result")] pub enum Command { + /// Web Client sends SDP Offer. MakeSdpOffer { peer_id: PeerID, sdp_offer: String }, + /// Web Client sends SDP Answer. MakeSdpAnswer { peer_id: PeerID, sdp_answer: String }, } +/// WebSocket message from Media Server to Web Client. #[derive(Debug, Deserialize, Serialize, Message)] pub enum Event { + /// Media Server notifies Web Client about necessity of RTCPeerConnection + /// creation. PeerCreated { peer_id: PeerID, sdp_offer: Option, }, - SdpAnswerMade { - peer_id: PeerID, - sdp_answer: String, - }, + /// Media Server notifies Web Client about necessity to apply specified SDP + /// Answer to Web Client's RTCPeerConnection. + SdpAnswerMade { peer_id: PeerID, sdp_answer: String }, } /// ID of [`Room`]. @@ -62,8 +72,10 @@ pub struct Room { /// Connections of [`Member`]'s this room. connections: HashMap>, + /// Peers of [`Member`]'s this room. member_peers: HashMap, + /// Relations peer to peer. peer_to_peer: HashMap, /// [`Peer`]s of [`Member`]'s this room. @@ -96,6 +108,7 @@ pub struct RpcConnectionEstablished { } impl Room { + /// Create new instance of [`Room`]. pub fn new(id: Id, members: HashMap) -> Self { Room { id, @@ -108,12 +121,17 @@ impl Room { } } + /// Generate next ID of [`Peer`]. fn next_peer_id(&mut self) -> PeerID { let id = self.peer_index; self.peer_index += 1; id } + /// Begins the negotiation process between peers. + /// + /// Creates audio and video tracks and stores links to them in + /// interconnected peers. fn start_pipeline( &mut self, caller: MemberID, @@ -131,16 +149,25 @@ impl Room { .ok_or(RoomError::MemberWithoutPeer(responder))?; self.peer_to_peer.insert(peer_caller_id, peer_responder_id); self.peer_to_peer.insert(peer_responder_id, peer_caller_id); + + let track_audio = + Arc::new(Track::new(1, TrackMediaType::Audio(AudioSettings {}))); + let track_video = + Arc::new(Track::new(2, TrackMediaType::Video(VideoSettings {}))); + let peer_caller = self .peers .remove(&peer_caller_id) .ok_or(RoomError::UnknownPeer(peer_caller_id))?; + let new_peer_caller = match peer_caller { - PeerMachine::New(peer) => { - Ok(PeerMachine::WaitLocalSDP(peer.start(|member_id| { + PeerMachine::New(mut peer) => { + peer.add_sender(track_audio.clone()); + peer.add_sender(track_video.clone()); + Ok(PeerMachine::WaitLocalSDP(peer.start(|id, member_id| { let connection = self.connections.get(&member_id).unwrap(); let event = Event::PeerCreated { - peer_id: peer_caller_id, + peer_id: id, sdp_offer: None, }; connection.send_event(event); @@ -149,6 +176,21 @@ impl Room { _ => Err(RoomError::UnmatchedState(peer_caller_id)), }?; self.peers.insert(peer_caller_id, new_peer_caller); + + let peer_responder = self + .peers + .remove(&peer_responder_id) + .ok_or(RoomError::UnknownPeer(peer_responder_id))?; + + let new_peer_responder = match peer_responder { + PeerMachine::New(mut peer) => { + peer.add_receiver(track_audio); + peer.add_receiver(track_video); + Ok(PeerMachine::New(peer)) + } + _ => Err(RoomError::UnmatchedState(peer_responder_id)), + }?; + self.peers.insert(peer_responder_id, new_peer_responder); Ok(()) } } @@ -241,6 +283,8 @@ impl Handler for Room { impl Handler for Room { type Result = Result; + /// Receives [`Command`] from Web client and changes state of interconnected + /// [`Peer`]s. fn handle( &mut self, command: Command, @@ -376,7 +420,6 @@ impl RoomsRepository { #[cfg(test)] mod test { - use std::sync::atomic::{AtomicUsize, Ordering}; use std::time::{Duration, Instant}; use futures::future::{result, Future}; @@ -386,18 +429,29 @@ mod test { #[derive(Debug, Clone)] struct TestConnection { + pub member_id: MemberID, pub room: Addr, - pub count_events: Arc, + pub events: Arc>>, } - impl RpcConnection for TestConnection { - fn close(&self) {} + impl Actor for TestConnection { + type Context = Context; - fn send_event(&self, event: Event) { - self.count_events.store( - self.count_events.load(Ordering::Relaxed) + 1, - Ordering::Relaxed, - ); + fn started(&mut self, ctx: &mut Self::Context) { + let caller_message = RpcConnectionEstablished { + member_id: self.member_id, + connection: Box::new(ctx.address()), + }; + self.room.do_send(caller_message); + } + } + + impl Handler for TestConnection { + type Result = (); + + fn handle(&mut self, event: Event, ctx: &mut Self::Context) { + let mut events = self.events.lock().unwrap(); + events.push(serde_json::to_string(&event).unwrap()); match event { Event::PeerCreated { peer_id, sdp_offer } => match sdp_offer { Some(_) => self.room.do_send(Command::MakeSdpAnswer { @@ -412,11 +466,21 @@ mod test { Event::SdpAnswerMade { peer_id: _, sdp_answer: _, - } => {} + } => { + System::current().stop(); + } } } } + impl RpcConnection for Addr { + fn close(&self) {} + + fn send_event(&self, event: Event) { + self.do_send(event); + } + } + fn start_room() -> Addr { let members = hashmap! { 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, @@ -427,42 +491,28 @@ mod test { #[test] fn start_signaling() { - let caller_event = Arc::new(AtomicUsize::new(0)); - let caller_event_clone = Arc::clone(&caller_event); - let responder_event = Arc::new(AtomicUsize::new(0)); - let responder_event_clone = Arc::clone(&responder_event); + let caller_events = Arc::new(Mutex::new(vec![])); + let caller_events_clone = Arc::clone(&caller_events); + let responder_events = Arc::new(Mutex::new(vec![])); + let responder_events_clone = Arc::clone(&responder_events); System::run(move || { let room = start_room(); - let caller = TestConnection { - room: room.clone(), - count_events: caller_event_clone, - }; - let responder = TestConnection { - room: room.clone(), - count_events: responder_event_clone, - }; - let caller_message = RpcConnectionEstablished { + let room_clone = room.clone(); + Arbiter::start(move |_| TestConnection { member_id: 1, - connection: Box::new(caller), - }; - let responder_message = RpcConnectionEstablished { + room: room_clone, + events: caller_events_clone, + }); + let room_clone = room.clone(); + Arbiter::start(move |_| TestConnection { member_id: 2, - connection: Box::new(responder), - }; - room.do_send(caller_message); - - tokio::spawn(room.send(responder_message).then(move |_| { - Delay::new(Instant::now() + Duration::new(0, 1_000_000)).then( - move |_| { - System::current().stop(); - result(Ok(())) - }, - ) - })); + room: room_clone, + events: responder_events_clone, + }); }); - assert_eq!(caller_event.load(Ordering::Relaxed), 2); - assert_eq!(responder_event.load(Ordering::Relaxed), 1); + assert_eq!(caller_events.lock().unwrap().len(), 2); + assert_eq!(responder_events.lock().unwrap().len(), 1); } } diff --git a/src/media/errors.rs b/src/media/errors.rs new file mode 100644 index 000000000..700d54abd --- /dev/null +++ b/src/media/errors.rs @@ -0,0 +1,7 @@ +use failure::Fail; + +#[derive(Fail, Debug)] +pub enum MediaError { + #[fail(display = "Unmatched state of track")] + UnmatchedTrackState, +} diff --git a/src/media/mod.rs b/src/media/mod.rs index af54a64bf..eb489d405 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -1,3 +1,9 @@ +pub mod errors; pub mod peer; +pub mod track; -pub use self::peer::{Id, Peer, PeerMachine}; +pub use self::{ + errors::MediaError, + peer::{Id as PeerID, Peer, PeerMachine}, + track::{AudioSettings, Id, Track, TrackMediaType, VideoSettings}, +}; diff --git a/src/media/peer.rs b/src/media/peer.rs index 5024eb547..b7c8b259e 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -1,55 +1,72 @@ -use crate::api::control::member::Id as MemberID; +use std::sync::Arc; -#[derive(Debug, Clone)] +use hashbrown::HashMap; + +use crate::{ + api::control::member::Id as MemberID, + media::{ + errors::MediaError, + track::{Id as TrackID, Track}, + }, +}; + +#[derive(Debug, Clone, PartialEq)] pub struct New {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct WaitLocalSDP {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct WaitLocalHaveRemote {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct WaitRemoteSDP {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Stable {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Finished {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct Failure {} +/// Implementation state machine for [`Peer`]. +#[derive(Debug, Clone)] +pub enum PeerMachine { + New(Peer), + WaitLocalSDP(Peer), + WaitLocalHaveRemote(Peer), + WaitRemoteSDP(Peer), + Stable(Peer), + Finished(Peer), + Failure(Peer), +} + /// ID of [`Peer`]. pub type Id = u64; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone)] pub struct PeerContext { id: Id, member_id: MemberID, sdp_offer: Option, sdp_answer: Option, + receivers: HashMap>, + senders: HashMap>, } +/// [`RTCPeerConnection`] representation. #[derive(Debug, Clone)] pub struct Peer { context: PeerContext, state: S, } -#[derive(Debug, Clone)] -pub enum PeerMachine { - New(Peer), - WaitLocalSDP(Peer), - WaitLocalHaveRemote(Peer), - WaitRemoteSDP(Peer), - Stable(Peer), - Finished(Peer), - Failure(Peer), -} - impl Peer { + /// Creates new [`Peer`] for [`Member`]. pub fn new(id: Id, member_id: MemberID) -> Self { let context = PeerContext { id, member_id, sdp_offer: None, sdp_answer: None, + receivers: HashMap::new(), + senders: HashMap::new(), }; Peer { context, @@ -57,17 +74,21 @@ impl Peer { } } + /// Sends PeerCreated event to Web Client and puts [`Peer`] into state + /// of waiting for local offer. pub fn start( self, - success: impl FnOnce(MemberID) -> (), + success: impl FnOnce(Id, MemberID) -> (), ) -> Peer { - success(self.context.member_id); + success(self.context.id, self.context.member_id); Peer { context: self.context, state: WaitLocalSDP {}, } } + /// Sends PeerCreated event with local offer to Web Client and puts [`Peer`] + /// into state of waiting for remote offer. pub fn set_remote_sdp( self, sdp_offer: String, @@ -81,6 +102,22 @@ impl Peer { state: WaitLocalHaveRemote {}, } } + + pub fn add_sender(&mut self, track: Arc) { + self.context.senders.insert(track.id, track); + } + + pub fn add_receiver(&mut self, track: Arc) { + self.context.receivers.insert(track.id, track); + } +} + +#[test] +fn create_peer() { + let peer = Peer::new(1, 1); + let peer = peer.start(|_, _| {}); + + assert_eq!(peer.state, WaitLocalSDP {}); } impl Peer { @@ -120,24 +157,3 @@ impl Peer { } } } - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn create_peer() { - let peer = Peer::new(1, 1); - let peer = peer.start(|_| {}); - - assert_eq!( - peer.context, - PeerContext { - id: 1, - member_id: 1, - sdp_offer: None, - sdp_answer: None - } - ); - } -} diff --git a/src/media/track.rs b/src/media/track.rs new file mode 100644 index 000000000..ce1307f94 --- /dev/null +++ b/src/media/track.rs @@ -0,0 +1,27 @@ +/// ID of [`Track`]. +pub type Id = u64; + +/// [`MediaStreamTrack`] representation. +#[derive(Debug)] +pub struct Track { + pub id: Id, + media_type: TrackMediaType, +} + +impl Track { + pub fn new(id: Id, media_type: TrackMediaType) -> Track { + Track { id, media_type } + } +} + +#[derive(Debug)] +pub enum TrackMediaType { + Audio(AudioSettings), + Video(VideoSettings), +} + +#[derive(Debug)] +pub struct AudioSettings {} + +#[derive(Debug)] +pub struct VideoSettings {} From d82e299a96769a621304bddeb6c9df31a299b2f2 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 8 Mar 2019 16:30:27 +0200 Subject: [PATCH 047/179] Move room to media module --- src/api/client/mod.rs | 3 +- src/api/client/server.rs | 9 ++-- src/api/client/session.rs | 6 +-- src/main.rs | 6 ++- src/media/mod.rs | 10 ++++- src/media/peer.rs | 75 ++++++++++++++++++++++++++++--- src/{api/client => media}/room.rs | 66 ++++++++++++++------------- src/media/track.rs | 29 ++++++++++-- 8 files changed, 148 insertions(+), 56 deletions(-) rename src/{api/client => media}/room.rs (91%) diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 0f3537eab..4022bf7ee 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,7 +1,6 @@ //! Implementation of Client API. -pub mod room; pub mod server; pub mod session; -pub use self::{room::*, server::*, session::*}; +pub use self::{server::*, session::*}; diff --git a/src/api/client/server.rs b/src/api/client/server.rs index 4990e0274..355a22d65 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -8,8 +8,9 @@ use futures::{future, Future}; use serde::Deserialize; use crate::{ - api::client::{GetMember, Id as RoomID, RoomsRepository, WsSession}, + api::client::WsSession, log::prelude::*, + media::room::{GetMember, Id as RoomID, RoomsRepository}, }; /// Contains [`Room`] ID and [`Member`] credentials obtained from request path. @@ -81,9 +82,9 @@ mod test { use actix_web::{http, test, App}; use futures::Stream; - use crate::api::{ - client::{session, Room}, - control::Member, + use crate::{ + api::{client::session, control::Member}, + media::Room, }; use super::*; diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 966448c4b..bdf715b54 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -7,12 +7,12 @@ use actix_web::ws::{self, CloseReason}; use serde::{Deserialize, Serialize}; use crate::{ - api::client::room::{ + api::control::member::Id as MemberID, + log::prelude::*, + media::{ Command, Event, Room, RpcConnection, RpcConnectionClosed, RpcConnectionClosedReason, RpcConnectionEstablished, }, - api::control::member::Id as MemberID, - log::prelude::*, }; use actix_web::ws::CloseCode; diff --git a/src/main.rs b/src/main.rs index e638e9a09..69d245b33 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,8 +2,10 @@ use actix::prelude::*; use dotenv::dotenv; -use crate::api::client::{server, Room, RoomsRepository}; -use crate::api::control::Member; +use crate::{ + api::{client::server, control::Member}, + media::{Room, RoomsRepository}, +}; #[macro_use] mod utils; diff --git a/src/media/mod.rs b/src/media/mod.rs index eb489d405..974bef37b 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -1,9 +1,15 @@ pub mod errors; pub mod peer; +pub mod room; pub mod track; pub use self::{ errors::MediaError, - peer::{Id as PeerID, Peer, PeerMachine}, - track::{AudioSettings, Id, Track, TrackMediaType, VideoSettings}, + peer::{Event, Id as PeerID, Peer, PeerMachine}, + room::{ + Command, Id as RoomID, Room, RoomsRepository, RpcConnection, + RpcConnectionClosed, RpcConnectionClosedReason, + RpcConnectionEstablished, + }, + track::Id as TrackID, }; diff --git a/src/media/peer.rs b/src/media/peer.rs index b7c8b259e..a4fc1f8bb 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -1,15 +1,33 @@ use std::sync::Arc; +use actix::prelude::*; use hashbrown::HashMap; +use serde::{Deserialize, Serialize}; use crate::{ api::control::member::Id as MemberID, + log::prelude::*, media::{ errors::MediaError, - track::{Id as TrackID, Track}, + track::{DirectionalTrack, Id as TrackID, Track, TrackDirection}, }, }; +/// WebSocket message from Media Server to Web Client. +#[derive(Debug, Deserialize, Serialize, Message)] +pub enum Event { + /// Media Server notifies Web Client about necessity of RTCPeerConnection + /// creation. + PeerCreated { + peer_id: Id, + sdp_offer: Option, + tracks: Vec, + }, + /// Media Server notifies Web Client about necessity to apply specified SDP + /// Answer to Web Client's RTCPeerConnection. + SdpAnswerMade { peer_id: Id, sdp_answer: String }, +} + #[derive(Debug, Clone, PartialEq)] pub struct New {} #[derive(Debug, Clone, PartialEq)] @@ -74,13 +92,49 @@ impl Peer { } } + pub fn get_tracks(&self, opponent_id: Id) -> Vec { + let tracks = self.context.senders.iter().fold( + vec![], + |mut tracks, (id, track)| { + tracks.push(DirectionalTrack { + id: track.id, + media_type: track.media_type.clone(), + direction: TrackDirection::Send { + receivers: vec![opponent_id], + }, + }); + tracks + }, + ); + self.context + .receivers + .iter() + .fold(tracks, |mut tracks, (id, track)| { + tracks.push(DirectionalTrack { + id: track.id, + media_type: track.media_type.clone(), + direction: TrackDirection::Recv { + sender: opponent_id, + }, + }); + tracks + }) + } + /// Sends PeerCreated event to Web Client and puts [`Peer`] into state /// of waiting for local offer. pub fn start( self, - success: impl FnOnce(Id, MemberID) -> (), + opponent_id: Id, + success: impl FnOnce(MemberID, Event) -> (), ) -> Peer { - success(self.context.id, self.context.member_id); + let tracks = self.get_tracks(opponent_id); + let event = Event::PeerCreated { + peer_id: self.context.id, + sdp_offer: None, + tracks, + }; + success(self.context.member_id, event); Peer { context: self.context, state: WaitLocalSDP {}, @@ -91,12 +145,19 @@ impl Peer { /// into state of waiting for remote offer. pub fn set_remote_sdp( self, + opponent_id: Id, sdp_offer: String, - success: impl Fn(Id, MemberID, String) -> (), + success: impl Fn(MemberID, Event) -> (), ) -> Peer { + let tracks = self.get_tracks(opponent_id); let mut context = self.context; - context.sdp_offer = Some(sdp_offer.clone()); - success(context.id, context.member_id, sdp_offer); + context.sdp_offer = Some(sdp_offer); + let event = Event::PeerCreated { + peer_id: context.id, + sdp_offer: context.sdp_offer.clone(), + tracks, + }; + success(context.member_id, event); Peer { context, state: WaitLocalHaveRemote {}, @@ -115,7 +176,7 @@ impl Peer { #[test] fn create_peer() { let peer = Peer::new(1, 1); - let peer = peer.start(|_, _| {}); + let peer = peer.start(2, |_, _| {}); assert_eq!(peer.state, WaitLocalSDP {}); } diff --git a/src/api/client/room.rs b/src/media/room.rs similarity index 91% rename from src/api/client/room.rs rename to src/media/room.rs index 12af5d261..86d5c23e9 100644 --- a/src/api/client/room.rs +++ b/src/media/room.rs @@ -9,9 +9,10 @@ use crate::{ api::control::{Id as MemberID, Member}, log::prelude::*, media::{ - peer::{Id as PeerID, Peer, PeerMachine}, + peer::{Event, Id as PeerID, Peer, PeerMachine}, track::{ - AudioSettings, Id as TrackID, Track, TrackMediaType, VideoSettings, + AudioSettings, DirectionalTrack, Track, TrackMediaType, + VideoSettings, }, }, }; @@ -43,20 +44,6 @@ pub enum Command { MakeSdpAnswer { peer_id: PeerID, sdp_answer: String }, } -/// WebSocket message from Media Server to Web Client. -#[derive(Debug, Deserialize, Serialize, Message)] -pub enum Event { - /// Media Server notifies Web Client about necessity of RTCPeerConnection - /// creation. - PeerCreated { - peer_id: PeerID, - sdp_offer: Option, - }, - /// Media Server notifies Web Client about necessity to apply specified SDP - /// Answer to Web Client's RTCPeerConnection. - SdpAnswerMade { peer_id: PeerID, sdp_answer: String }, -} - /// ID of [`Room`]. pub type Id = u64; @@ -164,14 +151,14 @@ impl Room { PeerMachine::New(mut peer) => { peer.add_sender(track_audio.clone()); peer.add_sender(track_video.clone()); - Ok(PeerMachine::WaitLocalSDP(peer.start(|id, member_id| { - let connection = self.connections.get(&member_id).unwrap(); - let event = Event::PeerCreated { - peer_id: id, - sdp_offer: None, - }; - connection.send_event(event); - }))) + Ok(PeerMachine::WaitLocalSDP(peer.start( + peer_responder_id, + |member_id, event| { + let connection = + self.connections.get(&member_id).unwrap(); + connection.send_event(event); + }, + ))) } _ => Err(RoomError::UnmatchedState(peer_caller_id)), }?; @@ -322,14 +309,11 @@ impl Handler for Room { let new_peer_responder = match peer_responder { PeerMachine::New(peer) => Ok( PeerMachine::WaitLocalHaveRemote(peer.set_remote_sdp( + peer_id, sdp_offer, - |peer_id, member_id, sdp_offer| { + |member_id, event| { let connection = self.connections.get(&member_id).unwrap(); - let event = Event::PeerCreated { - peer_id, - sdp_offer: Some(sdp_offer), - }; connection.send_event(event); }, )), @@ -453,7 +437,11 @@ mod test { let mut events = self.events.lock().unwrap(); events.push(serde_json::to_string(&event).unwrap()); match event { - Event::PeerCreated { peer_id, sdp_offer } => match sdp_offer { + Event::PeerCreated { + peer_id, + sdp_offer, + tracks, + } => match sdp_offer { Some(_) => self.room.do_send(Command::MakeSdpAnswer { peer_id, sdp_answer: "responder_answer".into(), @@ -512,7 +500,21 @@ mod test { }); }); - assert_eq!(caller_events.lock().unwrap().len(), 2); - assert_eq!(responder_events.lock().unwrap().len(), 1); + let mut caller_events = caller_events.lock().unwrap(); + let responder_events = responder_events.lock().unwrap(); + assert_eq!(caller_events.len(), 2); + assert_eq!( + caller_events.to_vec(), + vec![ + "{\"PeerCreated\":{\"peer_id\":0,\"sdp_offer\":null,\ + \"tracks\":[{\"id\":1,\"media_type\":{\"Audio\":{}},\ + \"direction\":{\"Send\":{\"receivers\":[1]}}},{\"id\":2,\ + \"media_type\":{\"Video\":{}},\"direction\":{\"Send\":\ + {\"receivers\":[1]}}}]}}", + "{\"SdpAnswerMade\":{\"peer_id\":0,\"sdp_answer\":\ + \"responder_answer\"}}", + ] + ); + assert_eq!(responder_events.len(), 1); } } diff --git a/src/media/track.rs b/src/media/track.rs index ce1307f94..44a371ed8 100644 --- a/src/media/track.rs +++ b/src/media/track.rs @@ -1,3 +1,7 @@ +use serde::{Deserialize, Serialize}; + +use crate::media::peer::Id as PeerID; + /// ID of [`Track`]. pub type Id = u64; @@ -5,23 +9,40 @@ pub type Id = u64; #[derive(Debug)] pub struct Track { pub id: Id, - media_type: TrackMediaType, + pub media_type: TrackMediaType, } impl Track { + /// Creates new [`Track`] of the specified type. pub fn new(id: Id, media_type: TrackMediaType) -> Track { Track { id, media_type } } } -#[derive(Debug)] +/// [`Track] with specified direction. +#[derive(Debug, Deserialize, Serialize)] +pub struct DirectionalTrack { + pub id: Id, + pub media_type: TrackMediaType, + pub direction: TrackDirection, +} + +/// Direction of [`Track`]. +#[derive(Debug, Deserialize, Serialize)] +pub enum TrackDirection { + Send { receivers: Vec }, + Recv { sender: PeerID }, +} + +/// Type of [`Track`]. +#[derive(Clone, Debug, Deserialize, Serialize)] pub enum TrackMediaType { Audio(AudioSettings), Video(VideoSettings), } -#[derive(Debug)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct AudioSettings {} -#[derive(Debug)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct VideoSettings {} From 0decf2811e8f662662b424e66ddeabd83e73559c Mon Sep 17 00:00:00 2001 From: alexlapa Date: Sun, 10 Mar 2019 23:39:34 -0600 Subject: [PATCH 048/179] impl ice candidates relay, impl test client, refactor --- signling_test.html | 163 ++++++++++++++++++++++++++ src/media/peer.rs | 32 +++++- src/media/room.rs | 281 ++++++++++++++++++++++++++++++--------------- 3 files changed, 381 insertions(+), 95 deletions(-) create mode 100644 signling_test.html diff --git a/signling_test.html b/signling_test.html new file mode 100644 index 000000000..8c4109d80 --- /dev/null +++ b/signling_test.html @@ -0,0 +1,163 @@ + + + + Chat + + + + + +
+
+
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/src/media/peer.rs b/src/media/peer.rs index a4fc1f8bb..15fa53e9a 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::{sync::Arc, any::Any}; use actix::prelude::*; use hashbrown::HashMap; @@ -25,7 +25,15 @@ pub enum Event { }, /// Media Server notifies Web Client about necessity to apply specified SDP /// Answer to Web Client's RTCPeerConnection. - SdpAnswerMade { peer_id: Id, sdp_answer: String }, + SdpAnswerMade { + peer_id: Id, + sdp_answer: String, + }, + + IceCandidateDiscovered { + peer_id: Id, + candidate: String, + }, } #[derive(Debug, Clone, PartialEq)] @@ -55,6 +63,20 @@ pub enum PeerMachine { Failure(Peer), } +impl PeerMachine { + pub fn get_member_id(&self) -> MemberID { + match self { + PeerMachine::New(peer) => peer.get_member_id(), + PeerMachine::WaitLocalSDP(peer) => peer.get_member_id(), + PeerMachine::WaitLocalHaveRemote(peer) => peer.get_member_id(), + PeerMachine::WaitRemoteSDP(peer) => peer.get_member_id(), + PeerMachine::Stable(peer) => peer.get_member_id(), + PeerMachine::Finished(peer) => peer.get_member_id(), + PeerMachine::Failure(peer) => peer.get_member_id(), + } + } +} + /// ID of [`Peer`]. pub type Id = u64; @@ -75,6 +97,12 @@ pub struct Peer { state: S, } +impl Peer { + pub fn get_member_id(&self) -> MemberID { + self.context.member_id + } +} + impl Peer { /// Creates new [`Peer`] for [`Member`]. pub fn new(id: Id, member_id: MemberID) -> Self { diff --git a/src/media/room.rs b/src/media/room.rs index 86d5c23e9..3e6dda3d1 100644 --- a/src/media/room.rs +++ b/src/media/room.rs @@ -39,9 +39,20 @@ pub enum RoomError { #[rtype(result = "Result")] pub enum Command { /// Web Client sends SDP Offer. - MakeSdpOffer { peer_id: PeerID, sdp_offer: String }, + MakeSdpOffer { + peer_id: PeerID, + sdp_offer: String, + }, /// Web Client sends SDP Answer. - MakeSdpAnswer { peer_id: PeerID, sdp_answer: String }, + MakeSdpAnswer { + peer_id: PeerID, + sdp_answer: String, + }, + + SetIceCandidate { + peer_id: PeerID, + candidate: String, + }, } /// ID of [`Room`]. @@ -115,6 +126,24 @@ impl Room { id } + fn remove_peer_by_id( + &mut self, + peer_id: &PeerID, + ) -> Result { + self.peers + .remove(peer_id) + .ok_or(RoomError::UnknownPeer(*peer_id)) + } + + fn get_peer_by_id( + &self, + peer_id: &PeerID, + ) -> Result<&PeerMachine, RoomError> { + self.peers + .get(peer_id) + .ok_or(RoomError::UnknownPeer(*peer_id)) + } + /// Begins the negotiation process between peers. /// /// Creates audio and video tracks and stores links to them in @@ -180,6 +209,155 @@ impl Room { self.peers.insert(peer_responder_id, new_peer_responder); Ok(()) } + + fn handle_make_sdp_offer( + &mut self, + from_peer_id: PeerID, + from_peer: PeerMachine, + sdp_offer: String, + ) -> Result { + let from_peer = match from_peer { + PeerMachine::WaitLocalSDP(peer) => Ok(PeerMachine::WaitRemoteSDP( + peer.set_local_sdp(sdp_offer.clone()), + )), + _ => { + error!("Unmatched state caller peer"); + Err(RoomError::UnmatchedState(from_peer_id)) + } + }?; + + self.peers.insert(from_peer_id, from_peer); + + let responder_peer_id = self + .peer_to_peer + .get(&from_peer_id) + .map(|&id| id) + .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; + let peer_responder = self + .peers + .remove(&responder_peer_id) + .ok_or(RoomError::UnknownPeer(responder_peer_id))?; + let new_peer_responder = match peer_responder { + PeerMachine::New(peer) => { + Ok(PeerMachine::WaitLocalHaveRemote(peer.set_remote_sdp( + from_peer_id, + sdp_offer, + |member_id, event| { + let connection = + self.connections.get(&member_id).unwrap(); + connection.send_event(event); + }, + ))) + } + _ => { + error!("Unmatched state responder peer"); + Err(RoomError::UnmatchedState(responder_peer_id)) + } + }?; + self.peers.insert(responder_peer_id, new_peer_responder); + Ok(true) + } + + fn handle_make_sdp_answer( + &mut self, + from_peer_id: PeerID, + from_peer: PeerMachine, + sdp_answer: String, + ) -> Result { + let from_peer = match from_peer { + PeerMachine::WaitLocalHaveRemote(peer) => { + Ok(PeerMachine::Stable(peer.set_local_sdp(sdp_answer.clone()))) + } + _ => { + error!("Unmatched state caller peer"); + Err(RoomError::UnmatchedState(from_peer_id)) + } + }?; + self.peers.insert(from_peer_id, from_peer); + + let caller_peer_id = self + .peer_to_peer + .get(&from_peer_id) + .map(|&id| id) + .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; + let peer_caller = self + .peers + .remove(&caller_peer_id) + .ok_or(RoomError::UnknownPeer(caller_peer_id))?; + let new_peer_caller = match peer_caller { + PeerMachine::WaitRemoteSDP(peer) => { + Ok(PeerMachine::Stable(peer.set_remote_sdp( + sdp_answer, + |peer_id, member_id, sdp_answer| { + let connection = + self.connections.get(&member_id).unwrap(); + let event = Event::SdpAnswerMade { + peer_id, + sdp_answer, + }; + connection.send_event(event); + }, + ))) + } + _ => Err(RoomError::UnmatchedState(caller_peer_id)), + }?; + self.peers.insert(caller_peer_id, new_peer_caller); + + Ok(true) + } + + fn handle_set_ice_candidate( + &self, + from_peer_id: PeerID, + from_peer: &PeerMachine, + candidate: String, + ) -> Result { + + fn send_candidate_to_remote( + room: &Room, + from_peer_id: PeerID, + candidate: String, + ) -> Result { + let remote_peer_id = room + .peer_to_peer + .get(&from_peer_id) + .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; + + let remote = room + .peers + .get(remote_peer_id) + .ok_or(RoomError::UnknownPeer(*remote_peer_id))?; + + let remote_member_id = remote.get_member_id(); + let remote = room + .connections + .get(&remote_member_id) + .ok_or(RoomError::InvalidConnection(remote_member_id))?; + + remote.send_event(Event::IceCandidateDiscovered { + peer_id: *remote_peer_id, + candidate, + }); + + Ok(true) + }; + + match from_peer { + PeerMachine::WaitLocalSDP(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + PeerMachine::WaitLocalHaveRemote(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + PeerMachine::WaitRemoteSDP(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + PeerMachine::Stable(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + _ => Err(RoomError::UnmatchedState(from_peer_id)), + } + } } /// Message for to get information about [`Member`] by its credentials. @@ -280,102 +458,19 @@ impl Handler for Room { debug!("receive command: {:?}", command); match command { Command::MakeSdpOffer { peer_id, sdp_offer } => { - let peer_caller = self - .peers - .remove(&peer_id) - .ok_or(RoomError::UnknownPeer(peer_id))?; - let new_peer_caller = match peer_caller { - PeerMachine::WaitLocalSDP(peer) => { - Ok(PeerMachine::WaitRemoteSDP( - peer.set_local_sdp(sdp_offer.clone()), - )) - } - _ => { - error!("Unmatched state caller peer"); - Err(RoomError::UnmatchedState(peer_id)) - } - }?; - self.peers.insert(peer_id, new_peer_caller); - - let responder_peer_id = self - .peer_to_peer - .get(&peer_id) - .map(|&id| id) - .ok_or(RoomError::NoOpponentPeer(peer_id))?; - let peer_responder = self - .peers - .remove(&responder_peer_id) - .ok_or(RoomError::UnknownPeer(responder_peer_id))?; - let new_peer_responder = match peer_responder { - PeerMachine::New(peer) => Ok( - PeerMachine::WaitLocalHaveRemote(peer.set_remote_sdp( - peer_id, - sdp_offer, - |member_id, event| { - let connection = - self.connections.get(&member_id).unwrap(); - connection.send_event(event); - }, - )), - ), - _ => { - error!("Unmatched state responder peer"); - Err(RoomError::UnmatchedState(responder_peer_id)) - } - }?; - self.peers.insert(responder_peer_id, new_peer_responder); - Ok(true) + let from_peer = self.remove_peer_by_id(&peer_id)?; + self.handle_make_sdp_offer(peer_id, from_peer, sdp_offer) } Command::MakeSdpAnswer { peer_id, sdp_answer, } => { - let peer_responder = self - .peers - .remove(&peer_id) - .ok_or(RoomError::UnknownPeer(peer_id))?; - let new_peer_responder = match peer_responder { - PeerMachine::WaitLocalHaveRemote(peer) => { - Ok(PeerMachine::Stable( - peer.set_local_sdp(sdp_answer.clone()), - )) - } - _ => { - error!("Unmatched state caller peer"); - Err(RoomError::UnmatchedState(peer_id)) - } - }?; - self.peers.insert(peer_id, new_peer_responder); - - let caller_peer_id = self - .peer_to_peer - .get(&peer_id) - .map(|&id| id) - .ok_or(RoomError::NoOpponentPeer(peer_id))?; - let peer_caller = self - .peers - .remove(&caller_peer_id) - .ok_or(RoomError::UnknownPeer(caller_peer_id))?; - let new_peer_caller = match peer_caller { - PeerMachine::WaitRemoteSDP(peer) => { - Ok(PeerMachine::Stable(peer.set_remote_sdp( - sdp_answer, - |peer_id, member_id, sdp_answer| { - let connection = - self.connections.get(&member_id).unwrap(); - let event = Event::SdpAnswerMade { - peer_id, - sdp_answer, - }; - connection.send_event(event); - }, - ))) - } - _ => Err(RoomError::UnmatchedState(caller_peer_id)), - }?; - self.peers.insert(caller_peer_id, new_peer_caller); - - Ok(true) + let from_peer = self.remove_peer_by_id(&peer_id)?; + self.handle_make_sdp_answer(peer_id, from_peer, sdp_answer) + } + Command::SetIceCandidate { peer_id, candidate } => { + let from_peer = self.get_peer_by_id(&peer_id)?; + self.handle_set_ice_candidate(peer_id, from_peer, candidate) } } } From c65228769fd13de6f537439a076a65bcdfc74fab Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 12 Mar 2019 17:03:27 +0200 Subject: [PATCH 049/179] Move command and event to client module - fix remove connection when client connection away --- Cargo.lock | 1 + Cargo.toml | 1 - signling_test.html => signaling_test.html | 4 +- src/api/client/commands.rs | 25 + src/api/client/events.rs | 27 + src/api/client/mod.rs | 7 +- src/api/client/room.rs | 461 +++++++++++++++- src/api/client/server.rs | 6 +- src/api/client/session.rs | 36 +- src/main.rs | 9 +- src/media/mod.rs | 10 +- src/media/peer.rs | 28 +- src/media/room.rs | 615 ---------------------- 13 files changed, 550 insertions(+), 680 deletions(-) rename signling_test.html => signaling_test.html (98%) create mode 100644 src/api/client/commands.rs create mode 100644 src/api/client/events.rs delete mode 100644 src/media/room.rs diff --git a/Cargo.lock b/Cargo.lock index a41f54a68..bc205e561 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -688,6 +688,7 @@ dependencies = [ "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 2b5e66723..fec2634c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" -failure = "0.1" [dev-dependencies] tokio = "0.1" diff --git a/signling_test.html b/signaling_test.html similarity index 98% rename from signling_test.html rename to signaling_test.html index 8c4109d80..305e58ded 100644 --- a/signling_test.html +++ b/signaling_test.html @@ -10,7 +10,7 @@ var pcs = {}; function connectSocket(caller) { - let role = caller ? "caller_credentials" : "responder_credentials"; + let role = caller ? "1/caller_credentials" : "2/responder_credentials"; socket = new WebSocket("ws://localhost:8080/ws/1/" + role); socket.onmessage = handleSocketMessage; @@ -160,4 +160,4 @@ - \ No newline at end of file + diff --git a/src/api/client/commands.rs b/src/api/client/commands.rs new file mode 100644 index 000000000..36e5ad777 --- /dev/null +++ b/src/api/client/commands.rs @@ -0,0 +1,25 @@ +use actix::Message; +use serde::{Deserialize, Serialize}; + +use crate::{api::client::RoomError, media::peer::Id as PeerId}; + +/// WebSocket message from Web Client to Media Server. +#[derive(Debug, Deserialize, Message, Serialize)] +#[rtype(result = "Result<(), RoomError>")] +pub enum Command { + /// Web Client sends SDP Offer. + MakeSdpOffer { + peer_id: PeerId, + sdp_offer: String, + }, + /// Web Client sends SDP Answer. + MakeSdpAnswer { + peer_id: PeerId, + sdp_answer: String, + }, + + SetIceCandidate { + peer_id: PeerId, + candidate: String, + }, +} diff --git a/src/api/client/events.rs b/src/api/client/events.rs new file mode 100644 index 000000000..377fcc7c8 --- /dev/null +++ b/src/api/client/events.rs @@ -0,0 +1,27 @@ +use actix::Message; +use serde::{Deserialize, Serialize}; + +use crate::media::{peer::Id as PeerId, track::DirectionalTrack}; + +/// WebSocket message from Media Server to Web Client. +#[derive(Debug, Deserialize, Message, Serialize)] +pub enum Event { + /// Media Server notifies Web Client about necessity of RTCPeerConnection + /// creation. + PeerCreated { + peer_id: PeerId, + sdp_offer: Option, + tracks: Vec, + }, + /// Media Server notifies Web Client about necessity to apply specified SDP + /// Answer to Web Client's RTCPeerConnection. + SdpAnswerMade { + peer_id: PeerId, + sdp_answer: String, + }, + + IceCandidateDiscovered { + peer_id: PeerId, + candidate: String, + }, +} diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 4022bf7ee..4a6bbe0ba 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,6 +1,11 @@ //! Implementation of Client API. +pub mod commands; +pub mod events; +pub mod room; pub mod server; pub mod session; -pub use self::{server::*, session::*}; +pub use self::{ + commands::Command, events::Event, room::*, server::*, session::*, +}; diff --git a/src/api/client/room.rs b/src/api/client/room.rs index 0023db16d..4ae701857 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -8,6 +8,7 @@ use std::{ use actix::{ fut::wrap_future, Actor, ActorFuture, Addr, Context, Handler, Message, }; +use failure::Fail; use futures::{ future::{self, Either}, Future, @@ -15,8 +16,13 @@ use futures::{ use hashbrown::HashMap; use crate::{ + api::client::{Command, Event}, api::control::{Id as MemberId, Member}, log::prelude::*, + media::{ + AudioSettings, Peer, PeerId, PeerMachine, Track, TrackMediaType, + VideoSettings, + }, }; /// ID of [`Room`]. @@ -31,8 +37,272 @@ pub struct Room { pub members: HashMap, /// Established [`WsSession`]s of [`Member`]s in this [`Room`]. pub connections: HashMap>, - /* TODO: Replace Box> with enum, - * as the set of all possible RpcConnection types is not closed. */ + // TODO: Replace Box> with enum, + // as the set of all possible RpcConnection types is not closed. + /// Peers of [`Member`]'s this room. + member_peers: HashMap, + + /// Relations peer to peer. + peer_to_peer: HashMap, + + /// [`Peer`]s of [`Member`]'s this room. + peers: HashMap, + + peer_index: u64, +} + +impl Room { + /// Create new instance of [`Room`]. + pub fn new(id: Id, members: HashMap) -> Self { + Room { + id, + members, + connections: HashMap::new(), + member_peers: HashMap::new(), + peers: HashMap::new(), + peer_to_peer: HashMap::new(), + peer_index: 0, + } + } + + /// Generate next ID of [`Peer`]. + fn next_peer_id(&mut self) -> PeerId { + let id = self.peer_index; + self.peer_index += 1; + id + } + + fn remove_peer_by_id( + &mut self, + peer_id: &PeerId, + ) -> Result { + self.peers + .remove(peer_id) + .ok_or(RoomError::UnknownPeer(*peer_id)) + } + + fn get_peer_by_id( + &self, + peer_id: &PeerId, + ) -> Result<&PeerMachine, RoomError> { + self.peers + .get(peer_id) + .ok_or(RoomError::UnknownPeer(*peer_id)) + } + + /// Begins the negotiation process between peers. + /// + /// Creates audio and video tracks and stores links to them in + /// interconnected peers. + fn start_pipeline( + &mut self, + caller: MemberId, + responder: MemberId, + ) -> Result<(), RoomError> { + let peer_caller_id = self + .member_peers + .get(&caller) + .map(|id| *id) + .ok_or(RoomError::MemberWithoutPeer(caller))?; + let peer_responder_id = self + .member_peers + .get(&responder) + .map(|id| *id) + .ok_or(RoomError::MemberWithoutPeer(responder))?; + self.peer_to_peer.insert(peer_caller_id, peer_responder_id); + self.peer_to_peer.insert(peer_responder_id, peer_caller_id); + + let track_audio = + Arc::new(Track::new(1, TrackMediaType::Audio(AudioSettings {}))); + let track_video = + Arc::new(Track::new(2, TrackMediaType::Video(VideoSettings {}))); + + let peer_caller = self + .peers + .remove(&peer_caller_id) + .ok_or(RoomError::UnknownPeer(peer_caller_id))?; + + let new_peer_caller = match peer_caller { + PeerMachine::New(mut peer) => { + peer.add_sender(track_audio.clone()); + peer.add_sender(track_video.clone()); + Ok(PeerMachine::WaitLocalSDP(peer.start( + peer_responder_id, + |member_id, event| { + let connection = + self.connections.get(&member_id).unwrap(); + connection.send_event(event); + }, + ))) + } + _ => Err(RoomError::UnmatchedState(peer_caller_id)), + }?; + self.peers.insert(peer_caller_id, new_peer_caller); + + let peer_responder = self + .peers + .remove(&peer_responder_id) + .ok_or(RoomError::UnknownPeer(peer_responder_id))?; + + let new_peer_responder = match peer_responder { + PeerMachine::New(mut peer) => { + peer.add_receiver(track_audio); + peer.add_receiver(track_video); + Ok(PeerMachine::New(peer)) + } + _ => Err(RoomError::UnmatchedState(peer_responder_id)), + }?; + self.peers.insert(peer_responder_id, new_peer_responder); + Ok(()) + } + + fn handle_make_sdp_offer( + &mut self, + from_peer_id: PeerId, + sdp_offer: String, + ) -> Result<(), RoomError> { + let from_peer = self.remove_peer_by_id(&from_peer_id)?; + let from_peer = match from_peer { + PeerMachine::WaitLocalSDP(peer) => Ok(PeerMachine::WaitRemoteSDP( + peer.set_local_sdp(sdp_offer.clone()), + )), + _ => { + error!("Unmatched state caller peer"); + Err(RoomError::UnmatchedState(from_peer_id)) + } + }?; + + self.peers.insert(from_peer_id, from_peer); + + let responder_peer_id = self + .peer_to_peer + .get(&from_peer_id) + .map(|&id| id) + .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; + let peer_responder = self + .peers + .remove(&responder_peer_id) + .ok_or(RoomError::UnknownPeer(responder_peer_id))?; + let new_peer_responder = match peer_responder { + PeerMachine::New(peer) => { + Ok(PeerMachine::WaitLocalHaveRemote(peer.set_remote_sdp( + from_peer_id, + sdp_offer, + |member_id, event| { + let connection = + self.connections.get(&member_id).unwrap(); + connection.send_event(event); + }, + ))) + } + _ => { + error!("Unmatched state responder peer"); + Err(RoomError::UnmatchedState(responder_peer_id)) + } + }?; + self.peers.insert(responder_peer_id, new_peer_responder); + Ok(()) + } + + fn handle_make_sdp_answer( + &mut self, + from_peer_id: PeerId, + sdp_answer: String, + ) -> Result<(), RoomError> { + let from_peer = self.remove_peer_by_id(&from_peer_id)?; + let from_peer = match from_peer { + PeerMachine::WaitLocalHaveRemote(peer) => { + Ok(PeerMachine::Stable(peer.set_local_sdp(sdp_answer.clone()))) + } + _ => { + error!("Unmatched state caller peer"); + Err(RoomError::UnmatchedState(from_peer_id)) + } + }?; + self.peers.insert(from_peer_id, from_peer); + + let caller_peer_id = self + .peer_to_peer + .get(&from_peer_id) + .map(|&id| id) + .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; + let peer_caller = self + .peers + .remove(&caller_peer_id) + .ok_or(RoomError::UnknownPeer(caller_peer_id))?; + let new_peer_caller = match peer_caller { + PeerMachine::WaitRemoteSDP(peer) => { + Ok(PeerMachine::Stable(peer.set_remote_sdp( + sdp_answer, + |peer_id, member_id, sdp_answer| { + let connection = + self.connections.get(&member_id).unwrap(); + let event = Event::SdpAnswerMade { + peer_id, + sdp_answer, + }; + connection.send_event(event); + }, + ))) + } + _ => Err(RoomError::UnmatchedState(caller_peer_id)), + }?; + self.peers.insert(caller_peer_id, new_peer_caller); + + Ok(()) + } + + fn handle_set_ice_candidate( + &mut self, + from_peer_id: PeerId, + candidate: String, + ) -> Result<(), RoomError> { + fn send_candidate_to_remote( + room: &Room, + from_peer_id: PeerId, + candidate: String, + ) -> Result<(), RoomError> { + let remote_peer_id = room + .peer_to_peer + .get(&from_peer_id) + .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; + + let remote = room + .peers + .get(remote_peer_id) + .ok_or(RoomError::UnknownPeer(*remote_peer_id))?; + + let remote_member_id = remote.get_member_id(); + let remote = room + .connections + .get(&remote_member_id) + .ok_or(RoomError::InvalidConnection(remote_member_id))?; + + remote.send_event(Event::IceCandidateDiscovered { + peer_id: *remote_peer_id, + candidate, + }); + + Ok(()) + }; + + let from_peer = self.remove_peer_by_id(&from_peer_id)?; + match from_peer { + PeerMachine::WaitLocalSDP(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + PeerMachine::WaitLocalHaveRemote(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + PeerMachine::WaitRemoteSDP(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + PeerMachine::Stable(_) => { + send_candidate_to_remote(self, from_peer_id, candidate) + } + _ => Err(RoomError::UnmatchedState(from_peer_id)), + } + } } /// [`Actor`] implementation that provides an ergonomic way @@ -46,6 +316,8 @@ pub trait RpcConnection: fmt::Debug + Send { /// Closes [`RpcConnection`]. /// No [`RpcConnectionClosed`] signals should be emitted. fn close(&mut self) -> Box>; + + fn send_event(&self, event: Event); } /// Signal for authorizing new [`RpcConnection`] before establishing. @@ -67,6 +339,20 @@ pub enum RpcConnectionAuthorizationError { InvalidCredentials, } +#[derive(Fail, Debug)] +pub enum RoomError { + #[fail(display = "Member without peer {}", _0)] + MemberWithoutPeer(MemberId), + #[fail(display = "Invalid connection of member {}", _0)] + InvalidConnection(MemberId), + #[fail(display = "Unknown peer {}", _0)] + UnknownPeer(PeerId), + #[fail(display = "Peer dont have opponent {}", _0)] + NoOpponentPeer(PeerId), + #[fail(display = "Unmatched state of peer {}", _0)] + UnmatchedState(PeerId), +} + impl Handler for Room { type Result = Result<(), RpcConnectionAuthorizationError>; @@ -98,7 +384,8 @@ pub struct RpcConnectionEstablished { } /// Ergonomic type alias for using [`ActorFuture`] for [`Room`]. -type ActFuture = Box>; +type ActFuture = + Box + 'static>; impl Handler for Room { type Result = ActFuture<(), ()>; @@ -115,14 +402,31 @@ impl Handler for Room { info!("RpcConnectionEstablished for member {}", msg.member_id); let mut fut = Either::A(future::ok(())); + let mut reconnected = false; if let Some(mut old_conn) = self.connections.remove(&msg.member_id) { debug!("Closing old RpcConnection for member {}", msg.member_id); fut = Either::B(old_conn.close()); + reconnected = true; } self.connections.insert(msg.member_id, msg.connection); + if !reconnected { + let peer_id = self.next_peer_id(); + let peer = PeerMachine::New(Peer::new(peer_id, msg.member_id)); + self.peers.insert(peer_id, peer); + self.member_peers.insert(msg.member_id, peer_id); + + info!("count connections: {}", self.connections.len()); + if self.connections.len() > 1 { + info!("Pipeline started."); + self.start_pipeline(1, 2).map_err(|err| { + error!("Failed start pipeline, because: {}", err) + }); + } + } + Box::new(wrap_future(fut)) } } @@ -158,6 +462,33 @@ impl Handler for Room { } } +impl Handler for Room { + type Result = ActFuture<(), RoomError>; + + /// Receives [`Command`] from Web client and changes state of interconnected + /// [`Peer`]s. + fn handle( + &mut self, + command: Command, + _ctx: &mut Self::Context, + ) -> Self::Result { + debug!("receive command: {:?}", command); + let fut = match command { + Command::MakeSdpOffer { peer_id, sdp_offer } => { + future::done(self.handle_make_sdp_offer(peer_id, sdp_offer)) + } + Command::MakeSdpAnswer { + peer_id, + sdp_answer, + } => future::done(self.handle_make_sdp_answer(peer_id, sdp_answer)), + Command::SetIceCandidate { peer_id, candidate } => { + future::done(self.handle_set_ice_candidate(peer_id, candidate)) + } + }; + Box::new(wrap_future(fut)) + } +} + /// Repository that stores [`Room`]s. #[derive(Clone, Default)] pub struct RoomsRepository { @@ -178,3 +509,127 @@ impl RoomsRepository { rooms.get(&id).cloned() } } + +#[cfg(test)] +mod test { + use std::time::{Duration, Instant}; + + use actix::{Arbiter, AsyncContext, System}; + use futures::future::{result, Future}; + use tokio::timer::Delay; + + use super::*; + + #[derive(Debug, Clone)] + struct TestConnection { + pub member_id: MemberId, + pub room: Addr, + pub events: Arc>>, + } + + impl Actor for TestConnection { + type Context = Context; + + fn started(&mut self, ctx: &mut Self::Context) { + let caller_message = RpcConnectionEstablished { + member_id: self.member_id, + connection: Box::new(ctx.address()), + }; + self.room.do_send(caller_message); + } + } + + impl Handler for TestConnection { + type Result = (); + + fn handle(&mut self, event: Event, ctx: &mut Self::Context) { + let mut events = self.events.lock().unwrap(); + events.push(serde_json::to_string(&event).unwrap()); + match event { + Event::PeerCreated { + peer_id, + sdp_offer, + tracks, + } => match sdp_offer { + Some(_) => self.room.do_send(Command::MakeSdpAnswer { + peer_id, + sdp_answer: "responder_answer".into(), + }), + None => self.room.do_send(Command::MakeSdpOffer { + peer_id, + sdp_offer: "caller_offer".into(), + }), + }, + Event::SdpAnswerMade { + peer_id: _, + sdp_answer: _, + } => { + System::current().stop(); + } + Event::IceCandidateDiscovered { + peer_id: _, + candidate: _, + } => {} + } + } + } + + impl RpcConnection for Addr { + fn close(&mut self) -> Box> { + Box::new(future::ok(())) + } + + fn send_event(&self, event: Event) { + self.do_send(event); + } + } + + fn start_room() -> Addr { + let members = hashmap! { + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + }; + Arbiter::start(move |_| Room::new(1, members)) + } + + #[test] + fn start_signaling() { + let caller_events = Arc::new(Mutex::new(vec![])); + let caller_events_clone = Arc::clone(&caller_events); + let responder_events = Arc::new(Mutex::new(vec![])); + let responder_events_clone = Arc::clone(&responder_events); + + System::run(move || { + let room = start_room(); + let room_clone = room.clone(); + Arbiter::start(move |_| TestConnection { + member_id: 1, + room: room_clone, + events: caller_events_clone, + }); + let room_clone = room.clone(); + Arbiter::start(move |_| TestConnection { + member_id: 2, + room: room_clone, + events: responder_events_clone, + }); + }); + + let mut caller_events = caller_events.lock().unwrap(); + let responder_events = responder_events.lock().unwrap(); + assert_eq!(caller_events.len(), 2); + assert_eq!( + caller_events.to_vec(), + vec![ + "{\"PeerCreated\":{\"peer_id\":0,\"sdp_offer\":null,\ + \"tracks\":[{\"id\":1,\"media_type\":{\"Audio\":{}},\ + \"direction\":{\"Send\":{\"receivers\":[1]}}},{\"id\":2,\ + \"media_type\":{\"Video\":{}},\"direction\":{\"Send\":\ + {\"receivers\":[1]}}}]}}", + "{\"SdpAnswerMade\":{\"peer_id\":0,\"sdp_answer\":\ + \"responder_answer\"}}", + ] + ); + assert_eq!(responder_events.len(), 1); + } +} diff --git a/src/api/client/server.rs b/src/api/client/server.rs index d3a96d334..0d4cc001f 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -108,11 +108,7 @@ mod test { 1 => Member{id: 1, credentials: "caller_credentials".into()}, 2 => Member{id: 2, credentials: "responder_credentials".into()}, }; - let room = Arbiter::start(move |_| Room { - id: 1, - members, - connections: HashMap::new(), - }); + let room = Arbiter::start(move |_| Room::new(1, members)); let rooms = hashmap! {1 => room}; RoomsRepository::new(rooms) } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index aef2b2297..cfa986f2e 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -7,15 +7,15 @@ use actix::{ Message, SpawnHandle, StreamHandler, }; use actix_web::ws::{self, CloseReason}; -use futures::Future; +use futures::{future, Future}; use serde::{Deserialize, Serialize}; use crate::{ - api::control::member::Id as MemberId, - media::{ + api::client::{ Command, Event, Room, RpcConnection, RpcConnectionClosed, RpcConnectionClosedReason, RpcConnectionEstablished, }, + api::control::member::Id as MemberId, log::prelude::*, }; @@ -110,8 +110,8 @@ impl Actor for WsSession { .map(|_| ()) .map_err(move |err| { error!( - "WsSession of member {} failed to join Room, \ - because: {:?}", + "WsSession of member {} failed to join Room, because: \ + {:?}", member_id, err, ) }), @@ -206,14 +206,23 @@ impl StreamHandler for WsSession { ctx.notify(msg); } if let Ok(command) = serde_json::from_str::(&text) { - self.room - .send(command) - .into_actor(self) - .then(|r, _a, _c| { - debug!("{:?}", r); - fut::ok::<(), (), Self>(()) - }) - .wait(ctx); + let member_id = self.member_id; + ctx.wait(wrap_future( + self.room + .send(command) + .and_then(move |res| match res { + Ok(_) => future::ok(()), + Err(err) => { + error!( + "Command from member {} handle \ + failed, because: {:?}", + member_id, err, + ); + future::ok(()) + } + }) + .map_err(|_| ()), + )); } } ws::Message::Close(reason) => { @@ -238,7 +247,6 @@ impl StreamHandler for WsSession { }), )); ctx.close(reason); - ctx.stop(); } } _ => error!( diff --git a/src/main.rs b/src/main.rs index 3a37bbf92..5bf89cd62 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,12 +3,9 @@ use actix::prelude::*; use dotenv::dotenv; -use crate::{ - api::{ - client::server, - control::Member, - }, - media::{Room, RoomsRepository}, +use crate::api::{ + client::{server, Room, RoomsRepository}, + control::Member, }; #[macro_use] diff --git a/src/media/mod.rs b/src/media/mod.rs index 974bef37b..1d45380b0 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -1,15 +1,11 @@ pub mod errors; pub mod peer; -pub mod room; pub mod track; pub use self::{ errors::MediaError, - peer::{Event, Id as PeerID, Peer, PeerMachine}, - room::{ - Command, Id as RoomID, Room, RoomsRepository, RpcConnection, - RpcConnectionClosed, RpcConnectionClosedReason, - RpcConnectionEstablished, + peer::{Id as PeerId, Peer, PeerMachine}, + track::{ + AudioSettings, Id as TrackId, Track, TrackMediaType, VideoSettings, }, - track::Id as TrackID, }; diff --git a/src/media/peer.rs b/src/media/peer.rs index 15fa53e9a..44d075bfa 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -1,10 +1,9 @@ -use std::{sync::Arc, any::Any}; +use std::{any::Any, sync::Arc}; -use actix::prelude::*; use hashbrown::HashMap; -use serde::{Deserialize, Serialize}; use crate::{ + api::client::Event, api::control::member::Id as MemberID, log::prelude::*, media::{ @@ -13,29 +12,6 @@ use crate::{ }, }; -/// WebSocket message from Media Server to Web Client. -#[derive(Debug, Deserialize, Serialize, Message)] -pub enum Event { - /// Media Server notifies Web Client about necessity of RTCPeerConnection - /// creation. - PeerCreated { - peer_id: Id, - sdp_offer: Option, - tracks: Vec, - }, - /// Media Server notifies Web Client about necessity to apply specified SDP - /// Answer to Web Client's RTCPeerConnection. - SdpAnswerMade { - peer_id: Id, - sdp_answer: String, - }, - - IceCandidateDiscovered { - peer_id: Id, - candidate: String, - }, -} - #[derive(Debug, Clone, PartialEq)] pub struct New {} #[derive(Debug, Clone, PartialEq)] diff --git a/src/media/room.rs b/src/media/room.rs deleted file mode 100644 index 3e6dda3d1..000000000 --- a/src/media/room.rs +++ /dev/null @@ -1,615 +0,0 @@ -//! Room definitions and implementations. -use std::sync::{Arc, Mutex}; - -use actix::prelude::*; -use hashbrown::HashMap; -use serde::{Deserialize, Serialize}; - -use crate::{ - api::control::{Id as MemberID, Member}, - log::prelude::*, - media::{ - peer::{Event, Id as PeerID, Peer, PeerMachine}, - track::{ - AudioSettings, DirectionalTrack, Track, TrackMediaType, - VideoSettings, - }, - }, -}; -use std::fmt::Debug; - -use failure::Fail; - -#[derive(Fail, Debug)] -pub enum RoomError { - #[fail(display = "Member without peer {}", _0)] - MemberWithoutPeer(MemberID), - #[fail(display = "Invalid connection of member {}", _0)] - InvalidConnection(MemberID), - #[fail(display = "Unknown peer {}", _0)] - UnknownPeer(PeerID), - #[fail(display = "Peer dont have opponent {}", _0)] - NoOpponentPeer(PeerID), - #[fail(display = "Unmatched state of peer {}", _0)] - UnmatchedState(PeerID), -} - -/// WebSocket message from Web Client to Media Server. -#[derive(Debug, Deserialize, Serialize, Message)] -#[rtype(result = "Result")] -pub enum Command { - /// Web Client sends SDP Offer. - MakeSdpOffer { - peer_id: PeerID, - sdp_offer: String, - }, - /// Web Client sends SDP Answer. - MakeSdpAnswer { - peer_id: PeerID, - sdp_answer: String, - }, - - SetIceCandidate { - peer_id: PeerID, - candidate: String, - }, -} - -/// ID of [`Room`]. -pub type Id = u64; - -/// Media server room with its members. -#[derive(Debug)] -pub struct Room { - /// ID of [`Room`]. - id: Id, - - /// [`Member`]'s this room. - members: HashMap, - - /// Connections of [`Member`]'s this room. - connections: HashMap>, - - /// Peers of [`Member`]'s this room. - member_peers: HashMap, - - /// Relations peer to peer. - peer_to_peer: HashMap, - - /// [`Peer`]s of [`Member`]'s this room. - peers: HashMap, - - peer_index: u64, -} - -/// [`Actor`] implementation that provides an ergonomic way for members -/// to interact in [` Room`]. -impl Actor for Room { - type Context = Context; -} - -/// Connection of [`Member`]. -pub trait RpcConnection: Debug + Send { - /// Close connection. - fn close(&self); - - /// Send event. - fn send_event(&self, event: Event); -} - -/// Message that [`Member`] has connected to [`Room`]. -#[derive(Message, Debug)] -#[rtype(result = "Result<(), RoomError>")] -pub struct RpcConnectionEstablished { - pub member_id: MemberID, - pub connection: Box, -} - -impl Room { - /// Create new instance of [`Room`]. - pub fn new(id: Id, members: HashMap) -> Self { - Room { - id, - members, - connections: HashMap::new(), - member_peers: HashMap::new(), - peers: HashMap::new(), - peer_to_peer: HashMap::new(), - peer_index: 0, - } - } - - /// Generate next ID of [`Peer`]. - fn next_peer_id(&mut self) -> PeerID { - let id = self.peer_index; - self.peer_index += 1; - id - } - - fn remove_peer_by_id( - &mut self, - peer_id: &PeerID, - ) -> Result { - self.peers - .remove(peer_id) - .ok_or(RoomError::UnknownPeer(*peer_id)) - } - - fn get_peer_by_id( - &self, - peer_id: &PeerID, - ) -> Result<&PeerMachine, RoomError> { - self.peers - .get(peer_id) - .ok_or(RoomError::UnknownPeer(*peer_id)) - } - - /// Begins the negotiation process between peers. - /// - /// Creates audio and video tracks and stores links to them in - /// interconnected peers. - fn start_pipeline( - &mut self, - caller: MemberID, - responder: MemberID, - ) -> Result<(), RoomError> { - let peer_caller_id = self - .member_peers - .get(&caller) - .map(|id| *id) - .ok_or(RoomError::MemberWithoutPeer(caller))?; - let peer_responder_id = self - .member_peers - .get(&responder) - .map(|id| *id) - .ok_or(RoomError::MemberWithoutPeer(responder))?; - self.peer_to_peer.insert(peer_caller_id, peer_responder_id); - self.peer_to_peer.insert(peer_responder_id, peer_caller_id); - - let track_audio = - Arc::new(Track::new(1, TrackMediaType::Audio(AudioSettings {}))); - let track_video = - Arc::new(Track::new(2, TrackMediaType::Video(VideoSettings {}))); - - let peer_caller = self - .peers - .remove(&peer_caller_id) - .ok_or(RoomError::UnknownPeer(peer_caller_id))?; - - let new_peer_caller = match peer_caller { - PeerMachine::New(mut peer) => { - peer.add_sender(track_audio.clone()); - peer.add_sender(track_video.clone()); - Ok(PeerMachine::WaitLocalSDP(peer.start( - peer_responder_id, - |member_id, event| { - let connection = - self.connections.get(&member_id).unwrap(); - connection.send_event(event); - }, - ))) - } - _ => Err(RoomError::UnmatchedState(peer_caller_id)), - }?; - self.peers.insert(peer_caller_id, new_peer_caller); - - let peer_responder = self - .peers - .remove(&peer_responder_id) - .ok_or(RoomError::UnknownPeer(peer_responder_id))?; - - let new_peer_responder = match peer_responder { - PeerMachine::New(mut peer) => { - peer.add_receiver(track_audio); - peer.add_receiver(track_video); - Ok(PeerMachine::New(peer)) - } - _ => Err(RoomError::UnmatchedState(peer_responder_id)), - }?; - self.peers.insert(peer_responder_id, new_peer_responder); - Ok(()) - } - - fn handle_make_sdp_offer( - &mut self, - from_peer_id: PeerID, - from_peer: PeerMachine, - sdp_offer: String, - ) -> Result { - let from_peer = match from_peer { - PeerMachine::WaitLocalSDP(peer) => Ok(PeerMachine::WaitRemoteSDP( - peer.set_local_sdp(sdp_offer.clone()), - )), - _ => { - error!("Unmatched state caller peer"); - Err(RoomError::UnmatchedState(from_peer_id)) - } - }?; - - self.peers.insert(from_peer_id, from_peer); - - let responder_peer_id = self - .peer_to_peer - .get(&from_peer_id) - .map(|&id| id) - .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; - let peer_responder = self - .peers - .remove(&responder_peer_id) - .ok_or(RoomError::UnknownPeer(responder_peer_id))?; - let new_peer_responder = match peer_responder { - PeerMachine::New(peer) => { - Ok(PeerMachine::WaitLocalHaveRemote(peer.set_remote_sdp( - from_peer_id, - sdp_offer, - |member_id, event| { - let connection = - self.connections.get(&member_id).unwrap(); - connection.send_event(event); - }, - ))) - } - _ => { - error!("Unmatched state responder peer"); - Err(RoomError::UnmatchedState(responder_peer_id)) - } - }?; - self.peers.insert(responder_peer_id, new_peer_responder); - Ok(true) - } - - fn handle_make_sdp_answer( - &mut self, - from_peer_id: PeerID, - from_peer: PeerMachine, - sdp_answer: String, - ) -> Result { - let from_peer = match from_peer { - PeerMachine::WaitLocalHaveRemote(peer) => { - Ok(PeerMachine::Stable(peer.set_local_sdp(sdp_answer.clone()))) - } - _ => { - error!("Unmatched state caller peer"); - Err(RoomError::UnmatchedState(from_peer_id)) - } - }?; - self.peers.insert(from_peer_id, from_peer); - - let caller_peer_id = self - .peer_to_peer - .get(&from_peer_id) - .map(|&id| id) - .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; - let peer_caller = self - .peers - .remove(&caller_peer_id) - .ok_or(RoomError::UnknownPeer(caller_peer_id))?; - let new_peer_caller = match peer_caller { - PeerMachine::WaitRemoteSDP(peer) => { - Ok(PeerMachine::Stable(peer.set_remote_sdp( - sdp_answer, - |peer_id, member_id, sdp_answer| { - let connection = - self.connections.get(&member_id).unwrap(); - let event = Event::SdpAnswerMade { - peer_id, - sdp_answer, - }; - connection.send_event(event); - }, - ))) - } - _ => Err(RoomError::UnmatchedState(caller_peer_id)), - }?; - self.peers.insert(caller_peer_id, new_peer_caller); - - Ok(true) - } - - fn handle_set_ice_candidate( - &self, - from_peer_id: PeerID, - from_peer: &PeerMachine, - candidate: String, - ) -> Result { - - fn send_candidate_to_remote( - room: &Room, - from_peer_id: PeerID, - candidate: String, - ) -> Result { - let remote_peer_id = room - .peer_to_peer - .get(&from_peer_id) - .ok_or(RoomError::NoOpponentPeer(from_peer_id))?; - - let remote = room - .peers - .get(remote_peer_id) - .ok_or(RoomError::UnknownPeer(*remote_peer_id))?; - - let remote_member_id = remote.get_member_id(); - let remote = room - .connections - .get(&remote_member_id) - .ok_or(RoomError::InvalidConnection(remote_member_id))?; - - remote.send_event(Event::IceCandidateDiscovered { - peer_id: *remote_peer_id, - candidate, - }); - - Ok(true) - }; - - match from_peer { - PeerMachine::WaitLocalSDP(_) => { - send_candidate_to_remote(self, from_peer_id, candidate) - } - PeerMachine::WaitLocalHaveRemote(_) => { - send_candidate_to_remote(self, from_peer_id, candidate) - } - PeerMachine::WaitRemoteSDP(_) => { - send_candidate_to_remote(self, from_peer_id, candidate) - } - PeerMachine::Stable(_) => { - send_candidate_to_remote(self, from_peer_id, candidate) - } - _ => Err(RoomError::UnmatchedState(from_peer_id)), - } - } -} - -/// Message for to get information about [`Member`] by its credentials. -#[derive(Message, Debug)] -#[rtype(result = "Option")] -pub struct GetMember { - pub credentials: String, -} - -/// Message that [`Member`] closed or lost connection. -#[derive(Message, Debug)] -pub struct RpcConnectionClosed { - pub member_id: MemberID, - pub reason: RpcConnectionClosedReason, -} - -/// [`RpcConnection`] close reasons. -#[derive(Debug)] -pub enum RpcConnectionClosedReason { - /// [`RpcConnection`] gracefully disconnected from server. - Disconnect, - /// [`RpcConnection`] was considered idle. - Idle, -} - -impl Handler for Room { - type Result = Option; - - /// Returns [`Member`] by its credentials if it present in [`Room`]. - fn handle( - &mut self, - msg: GetMember, - _ctx: &mut Self::Context, - ) -> Self::Result { - self.members - .values() - .find(|m| m.credentials.eq(msg.credentials.as_str())) - .map(|m| m.clone()) - } -} - -impl Handler for Room { - type Result = Result<(), RoomError>; - - /// Store connection of [`Member`] into [`Room`]. - /// - /// If the [`Member`] already has connection, it will be closed. - fn handle( - &mut self, - msg: RpcConnectionEstablished, - _ctx: &mut Self::Context, - ) -> Self::Result { - info!("RpcConnectionEstablished with member {:?}", &msg.member_id); - let mut reconnected = false; - if let Some(old_connection) = self.connections.remove(&msg.member_id) { - reconnected = true; - debug!("Reconnect WsSession for member {}", msg.member_id); - old_connection.close(); - } - self.connections.insert(msg.member_id, msg.connection); - if !reconnected { - let peer_id = self.next_peer_id(); - let peer = PeerMachine::New(Peer::new(peer_id, msg.member_id)); - self.peers.insert(peer_id, peer); - self.member_peers.insert(msg.member_id, peer_id); - - if self.connections.len() > 1 { - self.start_pipeline(1, 2)?; - } - } - Ok(()) - } -} - -impl Handler for Room { - type Result = (); - - /// Remove connection of [`Member`] from [`Room`]. - fn handle(&mut self, msg: RpcConnectionClosed, _ctx: &mut Self::Context) { - info!( - "RpcConnectionClosed with member {}, reason {:?}", - &msg.member_id, msg.reason - ); - self.connections.remove(&msg.member_id); - } -} - -impl Handler for Room { - type Result = Result; - - /// Receives [`Command`] from Web client and changes state of interconnected - /// [`Peer`]s. - fn handle( - &mut self, - command: Command, - _ctx: &mut Self::Context, - ) -> Self::Result { - debug!("receive command: {:?}", command); - match command { - Command::MakeSdpOffer { peer_id, sdp_offer } => { - let from_peer = self.remove_peer_by_id(&peer_id)?; - self.handle_make_sdp_offer(peer_id, from_peer, sdp_offer) - } - Command::MakeSdpAnswer { - peer_id, - sdp_answer, - } => { - let from_peer = self.remove_peer_by_id(&peer_id)?; - self.handle_make_sdp_answer(peer_id, from_peer, sdp_answer) - } - Command::SetIceCandidate { peer_id, candidate } => { - let from_peer = self.get_peer_by_id(&peer_id)?; - self.handle_set_ice_candidate(peer_id, from_peer, candidate) - } - } - } -} - -/// Repository that stores [`Room`]s. -#[derive(Clone, Default)] -pub struct RoomsRepository { - rooms: Arc>>>, -} - -impl RoomsRepository { - /// Creates new [`Room`]s repository with passed-in [`Room`]s. - pub fn new(rooms: HashMap>) -> Self { - RoomsRepository { - rooms: Arc::new(Mutex::new(rooms)), - } - } - - /// Returns [`Room`] by its ID. - pub fn get(&self, id: Id) -> Option> { - let rooms = self.rooms.lock().unwrap(); - rooms.get(&id).map(|r| r.clone()) - } -} - -#[cfg(test)] -mod test { - use std::time::{Duration, Instant}; - - use futures::future::{result, Future}; - use tokio::timer::Delay; - - use super::*; - - #[derive(Debug, Clone)] - struct TestConnection { - pub member_id: MemberID, - pub room: Addr, - pub events: Arc>>, - } - - impl Actor for TestConnection { - type Context = Context; - - fn started(&mut self, ctx: &mut Self::Context) { - let caller_message = RpcConnectionEstablished { - member_id: self.member_id, - connection: Box::new(ctx.address()), - }; - self.room.do_send(caller_message); - } - } - - impl Handler for TestConnection { - type Result = (); - - fn handle(&mut self, event: Event, ctx: &mut Self::Context) { - let mut events = self.events.lock().unwrap(); - events.push(serde_json::to_string(&event).unwrap()); - match event { - Event::PeerCreated { - peer_id, - sdp_offer, - tracks, - } => match sdp_offer { - Some(_) => self.room.do_send(Command::MakeSdpAnswer { - peer_id, - sdp_answer: "responder_answer".into(), - }), - None => self.room.do_send(Command::MakeSdpOffer { - peer_id, - sdp_offer: "caller_offer".into(), - }), - }, - Event::SdpAnswerMade { - peer_id: _, - sdp_answer: _, - } => { - System::current().stop(); - } - } - } - } - - impl RpcConnection for Addr { - fn close(&self) {} - - fn send_event(&self, event: Event) { - self.do_send(event); - } - } - - fn start_room() -> Addr { - let members = hashmap! { - 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, - }; - Arbiter::start(move |_| Room::new(1, members)) - } - - #[test] - fn start_signaling() { - let caller_events = Arc::new(Mutex::new(vec![])); - let caller_events_clone = Arc::clone(&caller_events); - let responder_events = Arc::new(Mutex::new(vec![])); - let responder_events_clone = Arc::clone(&responder_events); - - System::run(move || { - let room = start_room(); - let room_clone = room.clone(); - Arbiter::start(move |_| TestConnection { - member_id: 1, - room: room_clone, - events: caller_events_clone, - }); - let room_clone = room.clone(); - Arbiter::start(move |_| TestConnection { - member_id: 2, - room: room_clone, - events: responder_events_clone, - }); - }); - - let mut caller_events = caller_events.lock().unwrap(); - let responder_events = responder_events.lock().unwrap(); - assert_eq!(caller_events.len(), 2); - assert_eq!( - caller_events.to_vec(), - vec![ - "{\"PeerCreated\":{\"peer_id\":0,\"sdp_offer\":null,\ - \"tracks\":[{\"id\":1,\"media_type\":{\"Audio\":{}},\ - \"direction\":{\"Send\":{\"receivers\":[1]}}},{\"id\":2,\ - \"media_type\":{\"Video\":{}},\"direction\":{\"Send\":\ - {\"receivers\":[1]}}}]}}", - "{\"SdpAnswerMade\":{\"peer_id\":0,\"sdp_answer\":\ - \"responder_answer\"}}", - ] - ); - assert_eq!(responder_events.len(), 1); - } -} From ffeb144742cebe981b948de3732a35f1fdca4eb6 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 19 Mar 2019 16:39:22 +0200 Subject: [PATCH 050/179] Impl send event by Room --- Cargo.lock | 27 ++-- Cargo.toml | 3 +- src/api/client/connection.rs | 246 +++++++++++++++++++++++++++++++++++ src/api/client/events.rs | 27 ++++ src/api/client/mod.rs | 4 +- src/api/client/room.rs | 162 +++++++++++++++++++++-- src/api/client/server.rs | 16 +-- src/api/client/session.rs | 245 +++++----------------------------- src/main.rs | 15 +-- src/media/mod.rs | 9 ++ src/media/peer.rs | 230 ++++++++++++++++++++++++++++++++ src/media/track.rs | 48 +++++++ 12 files changed, 776 insertions(+), 256 deletions(-) create mode 100644 src/api/client/connection.rs create mode 100644 src/api/client/events.rs create mode 100644 src/media/mod.rs create mode 100644 src/media/peer.rs create mode 100644 src/media/track.rs diff --git a/Cargo.lock b/Cargo.lock index a41f54a68..89b3535e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,7 +75,7 @@ dependencies = [ "http 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 1.2.1 (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)", @@ -305,7 +305,7 @@ dependencies = [ "crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-epoch 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -338,7 +338,7 @@ dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (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)", ] @@ -357,7 +357,7 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -613,7 +613,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "lazy_static" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -680,6 +680,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.84 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1094,7 +1095,7 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1249,7 +1250,7 @@ version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1362,7 +1363,7 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1452,7 +1453,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (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)", "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1565,7 +1566,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (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)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1588,7 +1589,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (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)", "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1611,7 +1612,7 @@ dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "ipconfig 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.2.0 (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)", "lru-cache 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1865,7 +1866,7 @@ dependencies = [ "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" -"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" +"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" "checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" "checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" "checksum linked-hash-map 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7860ec297f7008ff7a1e3382d7f7e1dcd69efc94751a2284bafc3d013c2aa939" diff --git a/Cargo.toml b/Cargo.toml index 8c5c0f600..6fba0956c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,10 @@ actix = "0.7" actix-web = "0.7" chrono = "0.4" dotenv = "0.13" +failure = "0.1" futures = "0.1" hashbrown = "0.1" +lazy_static = "1.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" slog = "2.4" @@ -24,4 +26,3 @@ slog-stdlog = "3.0" slog-async = "2.3" slog-json = "2.3" slog-scope = "4.1" -failure = "0.1" diff --git a/src/api/client/connection.rs b/src/api/client/connection.rs new file mode 100644 index 000000000..068c1be5a --- /dev/null +++ b/src/api/client/connection.rs @@ -0,0 +1,246 @@ +//! WebSocket session. + +use std::time::Duration; + +use actix::{ + fut::wrap_future, Actor, ActorContext, Addr, AsyncContext, Handler, + Message, SpawnHandle, StreamHandler, +}; +use actix_web::ws::{self, CloseReason}; +use futures::Future; +use serde::{Deserialize, Serialize}; + +use crate::{ + api::client::{ + Event, Room, RpcConnection, RpcConnectionClosed, + RpcConnectionClosedReason, RpcConnectionEstablished, + }, + api::control::member::Id as MemberId, + log::prelude::*, +}; + +// TODO: via conf +/// Timeout of receiving any WebSocket messages from client. +pub const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); + +/// Long-running WebSocket connection of Client API. +#[derive(Debug)] +#[allow(clippy::module_name_repetitions)] +pub struct WsConnection { + /// ID of [`Member`] that WebSocket connection is associated with. + member_id: MemberId, + /// [`Room`] that [`Member`] is associated with. + room: Addr, + + /// Handle for watchdog which checks whether WebSocket client became + /// idle (no `ping` messages received during [`CLIENT_IDLE_TIMEOUT`]). + /// + /// This one should be renewed on any received WebSocket message + /// from client. + idle_handler: Option, + + /// Indicates whether WebSocket connection is closed by server ot by + /// client. + closed_by_server: bool, +} + +impl WsConnection { + /// Creates new [`WsSession`] for specified [`Member`]. + pub fn new(member_id: MemberId, room: Addr) -> Self { + Self { + member_id, + room, + idle_handler: None, + closed_by_server: false, + } + } + + /// Resets idle handler watchdog. + fn reset_idle_timeout(&mut self, ctx: &mut ::Context) { + if let Some(handler) = self.idle_handler { + ctx.cancel_future(handler); + } + + self.idle_handler = + Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |sess, ctx| { + info!("WsConnection with member {} is idle", sess.member_id); + + let member_id = sess.member_id; + ctx.wait(wrap_future( + sess.room + .send(RpcConnectionClosed { + member_id, + reason: RpcConnectionClosedReason::Idle, + }) + .map_err(move |err| { + error!( + "WsSession of member {} failed to remove from \ + Room, because: {:?}", + member_id, err, + ) + }), + )); + + ctx.notify(Close { + reason: Some(ws::CloseCode::Normal.into()), + }); + })); + } +} + +/// [`Actor`] implementation that provides an ergonomic way to deal with +/// WebSocket connection lifecycle for [`WsSession`]. +impl Actor for WsConnection { + type Context = ws::WebsocketContext; + + /// Starts [`Heartbeat`] mechanism and sends [`RpcConnectionEstablished`] + /// signal to the [`Room`]. + fn started(&mut self, ctx: &mut Self::Context) { + debug!("Started WsSession for member {}", self.member_id); + + self.reset_idle_timeout(ctx); + + let member_id = self.member_id; + ctx.wait(wrap_future( + self.room + .send(RpcConnectionEstablished { + member_id: self.member_id, + connection: Box::new(ctx.address()), + }) + .map(|_| ()) + .map_err(move |err| { + error!( + "WsConnection of member {} failed to join Room, \ + because: {:?}", + member_id, err, + ) + }), + )); + } + + fn stopped(&mut self, _ctx: &mut Self::Context) { + debug!("Stopped WsSession for member {}", self.member_id); + } +} + +impl RpcConnection for Addr { + /// Closes [`WsSession`] by sending itself "normal closure" close message. + fn close(&self) -> Box> { + let fut = self + .send(Close { + reason: Some(ws::CloseCode::Normal.into()), + }) + .map_err(|_| ()); + Box::new(fut) + } + + fn send_event( + &self, + event: Event, + ) -> Box> { + let fut = self + .send(event) + .map_err(|err| error!("Failed send event {:?} ", err)); + Box::new(fut) + } +} + +/// Message for closing [`WsSession`]. +#[derive(Message)] +pub struct Close { + reason: Option, +} + +impl Handler for WsConnection { + type Result = (); + + /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. + fn handle(&mut self, close: Close, ctx: &mut Self::Context) { + debug!("Closing WsSession for member {}", self.member_id); + self.closed_by_server = true; + ctx.close(close.reason); + ctx.stop(); + } +} + +impl Handler for WsConnection { + type Result = (); + + fn handle(&mut self, event: Event, ctx: &mut Self::Context) { + debug!("Event {:?} for member {}", event, self.member_id); + ctx.text(serde_json::to_string(&event).unwrap()) + } +} + +/// Message for keeping client WebSocket connection alive. +#[derive(Debug, Deserialize, Message, Serialize)] +pub enum Heartbeat { + /// `ping` message that WebSocket client is expected to send to the server + /// periodically. + #[serde(rename = "ping")] + Ping(usize), + /// `pong` message that server answers with to WebSocket client in response + /// to received `ping` message. + #[serde(rename = "pong")] + Pong(usize), +} + +impl Handler for WsConnection { + type Result = (); + + /// Answers with `Heartbeat::Pong` message to WebSocket client in response + /// to the received `Heartbeat::Ping` message. + fn handle(&mut self, msg: Heartbeat, ctx: &mut Self::Context) { + if let Heartbeat::Ping(n) = msg { + trace!("Received ping: {}", n); + ctx.text(serde_json::to_string(&Heartbeat::Pong(n)).unwrap()) + } + } +} + +impl StreamHandler for WsConnection { + /// Handles arbitrary [`ws::Message`] received from WebSocket client. + fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { + debug!( + "Received WS message: {:?} from member {}", + msg, self.member_id + ); + match msg { + ws::Message::Text(text) => { + self.reset_idle_timeout(ctx); + if let Ok(msg) = serde_json::from_str::(&text) { + ctx.notify(msg); + } + } + ws::Message::Close(reason) => { + if !self.closed_by_server { + debug!( + "Send close frame with reason {:?} for member {}", + reason, self.member_id + ); + let member_id = self.member_id; + ctx.wait(wrap_future( + self.room + .send(RpcConnectionClosed { + member_id: self.member_id, + reason: RpcConnectionClosedReason::Disconnected, + }) + .map_err(move |err| { + error!( + "WsSession of member {} failed to remove \ + from Room, because: {:?}", + member_id, err, + ) + }), + )); + ctx.close(reason); + ctx.stop(); + } + } + _ => error!( + "Unsupported client message from member {}", + self.member_id + ), + } + } +} diff --git a/src/api/client/events.rs b/src/api/client/events.rs new file mode 100644 index 000000000..377fcc7c8 --- /dev/null +++ b/src/api/client/events.rs @@ -0,0 +1,27 @@ +use actix::Message; +use serde::{Deserialize, Serialize}; + +use crate::media::{peer::Id as PeerId, track::DirectionalTrack}; + +/// WebSocket message from Media Server to Web Client. +#[derive(Debug, Deserialize, Message, Serialize)] +pub enum Event { + /// Media Server notifies Web Client about necessity of RTCPeerConnection + /// creation. + PeerCreated { + peer_id: PeerId, + sdp_offer: Option, + tracks: Vec, + }, + /// Media Server notifies Web Client about necessity to apply specified SDP + /// Answer to Web Client's RTCPeerConnection. + SdpAnswerMade { + peer_id: PeerId, + sdp_answer: String, + }, + + IceCandidateDiscovered { + peer_id: PeerId, + candidate: String, + }, +} diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 0f3537eab..63b44794b 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,7 +1,9 @@ //! Implementation of Client API. +pub mod connection; +pub mod events; pub mod room; pub mod server; pub mod session; -pub use self::{room::*, server::*, session::*}; +pub use self::{connection::*, events::*, room::*, server::*, session::*}; diff --git a/src/api/client/room.rs b/src/api/client/room.rs index 0023db16d..d1b1db5f7 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -6,19 +6,38 @@ use std::{ }; use actix::{ - fut::wrap_future, Actor, ActorFuture, Addr, Context, Handler, Message, + fut::wrap_future, Actor, ActorFuture, Addr, AsyncContext, Context, Handler, + Message, }; use futures::{ - future::{self, Either}, + future::{self, join_all, Either}, Future, }; use hashbrown::HashMap; use crate::{ + api::client::{Event, Session}, api::control::{Id as MemberId, Member}, log::prelude::*, + media::{ + peer::{Id as PeerId, Peer, PeerMachine}, + track::{ + AudioSettings, Id as TrackId, Track, TrackMediaType, VideoSettings, + }, + }, }; +lazy_static! { + static ref PEER_INDEX: Mutex = Mutex::new(0); +} + +/// Generate next ID of [`Peer`]. +fn next_peer_id() -> PeerId { + let mut index = PEER_INDEX.lock().unwrap(); + *index += 1; + *index +} + /// ID of [`Room`]. pub type Id = u64; @@ -29,12 +48,49 @@ pub struct Room { pub id: Id, /// [`Member`]s which currently are present in this [`Room`]. pub members: HashMap, - /// Established [`WsSession`]s of [`Member`]s in this [`Room`]. - pub connections: HashMap>, + /// [`Session`]s of [`Member`]s in this [`Room`]. + pub sessions: HashMap, /* TODO: Replace Box> with enum, * as the set of all possible RpcConnection types is not closed. */ } +impl Room { + /// Create new instance of [`Room`]. + pub fn new(id: Id, members: HashMap) -> Self { + Room { + id, + members, + sessions: HashMap::new(), + } + } + + pub fn session_by_peer( + &mut self, + peer_id: PeerId, + ) -> Option<(&u64, &mut Session)> { + self.sessions + .iter_mut() + .find(|(_, s)| s.peers.contains_key(&peer_id)) + } + + pub fn remove_session(&mut self, member_id: MemberId) { + if let Some(session) = self.sessions.remove(&member_id) { + for peer in session.peers.values() { + let opponent_peer_id = peer.opponent_id(); + if let Some((_, opp_session)) = + self.session_by_peer(opponent_peer_id) + { + info!( + "Remove peer {:?} of member {:?}", + opponent_peer_id, opp_session.member_id + ); + opp_session.remove_peer(opponent_peer_id); + } + } + } + } +} + /// [`Actor`] implementation that provides an ergonomic way /// to interact with [`Room`]. impl Actor for Room { @@ -45,7 +101,12 @@ impl Actor for Room { pub trait RpcConnection: fmt::Debug + Send { /// Closes [`RpcConnection`]. /// No [`RpcConnectionClosed`] signals should be emitted. - fn close(&mut self) -> Box>; + fn close(&self) -> Box>; + + fn send_event( + &self, + event: Event, + ) -> Box>; } /// Signal for authorizing new [`RpcConnection`] before establishing. @@ -110,23 +171,79 @@ impl Handler for Room { fn handle( &mut self, msg: RpcConnectionEstablished, - _: &mut Self::Context, + ctx: &mut Self::Context, ) -> Self::Result { info!("RpcConnectionEstablished for member {}", msg.member_id); let mut fut = Either::A(future::ok(())); + if let Some(session) = self.sessions.get_mut(&msg.member_id) { + debug!( + "Replaced RpcConnection for member {} session", + msg.member_id + ); + fut = Either::B(session.set_connection(msg.connection)); + } else { + let member_id = msg.member_id; + let mut session = Session::new(msg.member_id, msg.connection); - if let Some(mut old_conn) = self.connections.remove(&msg.member_id) { - debug!("Closing old RpcConnection for member {}", msg.member_id); - fut = Either::B(old_conn.close()); + info!("Members in room: {:?}", self.sessions.len()); + let events = self + .sessions + .iter_mut() + .filter(|&(&m_id, _)| m_id != member_id) + .fold(vec![], |mut events, (_, callee)| { + events.push(start_pipeline(&mut session, callee)); + events + }); + self.sessions.insert(member_id, session); + events.into_iter().for_each(|e| { + ctx.notify(MemberEvent { + member_id, + event: e, + }) + }) } - self.connections.insert(msg.member_id, msg.connection); - Box::new(wrap_future(fut)) } } +fn start_pipeline(caller: &mut Session, callee: &mut Session) -> Event { + info!( + "Member {} call member {}", + caller.member_id, callee.member_id + ); + let caller_peer_id = next_peer_id(); + let callee_peer_id = next_peer_id(); + let mut caller_peer = + Peer::new(caller_peer_id, caller.member_id, callee_peer_id); + let mut callee_peer = + Peer::new(callee_peer_id, callee.member_id, caller_peer_id); + + let track_audio = + Arc::new(Track::new(1, TrackMediaType::Audio(AudioSettings {}))); + let track_video = + Arc::new(Track::new(2, TrackMediaType::Video(VideoSettings {}))); + caller_peer.add_sender(track_audio.clone()); + caller_peer.add_sender(track_video.clone()); + callee_peer.add_receiver(track_audio); + callee_peer.add_receiver(track_video); + + let event = Event::PeerCreated { + peer_id: caller_peer.id(), + sdp_offer: None, + tracks: caller_peer.tracks(), + }; + let caller_peer = PeerMachine::WaitLocalSDP(caller_peer.start()); + caller.add_peer(caller_peer); + + let callee_peer = PeerMachine::New(callee_peer); + callee.add_peer(callee_peer); + + info!("Send event: {:?}", event); + event +} + /// Signal of existing [`RpcConnection`] of specified [`Member`] being closed. #[derive(Debug, Message)] pub struct RpcConnectionClosed { @@ -148,13 +265,32 @@ pub enum RpcConnectionClosedReason { impl Handler for Room { type Result = (); - /// Removes [`RpcConnection`] of specified [`Member`] from the [`Room`]. + /// Removes [`Session`] of specified [`Member`] from the [`Room`]. fn handle(&mut self, msg: RpcConnectionClosed, _: &mut Self::Context) { info!( "RpcConnectionClosed for member {}, reason {:?}", msg.member_id, msg.reason ); - self.connections.remove(&msg.member_id); + self.remove_session(msg.member_id); + } +} + +#[derive(Debug, Message)] +struct MemberEvent { + member_id: MemberId, + event: Event, +} + +impl Handler for Room { + type Result = (); + + /// Send [`Event`] to specified [`Member`] from the [`Room`]. + fn handle(&mut self, msg: MemberEvent, ctx: &mut Self::Context) { + let member_id = msg.member_id; + info!("Send event {:?} for member {}", msg.event, msg.member_id); + if let Some(session) = self.sessions.get(&member_id) { + ctx.wait(wrap_future(session.send_event(msg.event))) + } } } diff --git a/src/api/client/server.rs b/src/api/client/server.rs index d3a96d334..7a8cec7a5 100644 --- a/src/api/client/server.rs +++ b/src/api/client/server.rs @@ -11,7 +11,7 @@ use crate::{ api::{ client::{ AuthorizeRpcConnection, Id as RoomId, RoomsRepository, - RpcConnectionAuthorizationError, WsSession, + RpcConnectionAuthorizationError, WsConnection, }, control::Id as MemberId, }, @@ -52,7 +52,7 @@ fn ws_index( .and_then(move |res| match res { Ok(_) => ws::start( &r.drop_state(), - WsSession::new(info.member_id, room), + WsConnection::new(info.member_id, room), ), Err(MemberNotExists) => Ok(HttpResponse::NotFound().into()), Err(InvalidCredentials) => Ok(HttpResponse::Forbidden().into()), @@ -96,7 +96,7 @@ mod test { use hashbrown::HashMap; use crate::api::{ - client::{session, Room}, + client::{connection, Room}, control::Member, }; @@ -108,11 +108,7 @@ mod test { 1 => Member{id: 1, credentials: "caller_credentials".into()}, 2 => Member{id: 2, credentials: "responder_credentials".into()}, }; - let room = Arbiter::start(move |_| Room { - id: 1, - members, - connections: HashMap::new(), - }); + let room = Arbiter::start(move |_| Room::new(1, members)); let rooms = hashmap! {1 => room}; RoomsRepository::new(rooms) } @@ -148,7 +144,9 @@ mod test { let (item, read) = server.execute(read.into_future()).unwrap(); assert_eq!(item, Some(ws::Message::Text(r#"{"pong":33}"#.into()))); - thread::sleep(session::CLIENT_IDLE_TIMEOUT.add(Duration::from_secs(1))); + thread::sleep( + connection::CLIENT_IDLE_TIMEOUT.add(Duration::from_secs(1)), + ); let (item, _) = server.execute(read.into_future()).unwrap(); assert_eq!( diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 3e0c5cd7a..54f5bd40d 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -1,227 +1,50 @@ -//! WebSocket session. - -use std::time::Duration; - -use actix::{ - fut::wrap_future, Actor, ActorContext, Addr, AsyncContext, Handler, - Message, SpawnHandle, StreamHandler, -}; -use actix_web::ws::{self, CloseReason}; use futures::Future; -use serde::{Deserialize, Serialize}; - -use crate::{ - api::client::room::{ - Room, RpcConnection, RpcConnectionClosed, RpcConnectionClosedReason, - RpcConnectionEstablished, - }, - api::control::member::Id as MemberId, - log::prelude::*, -}; +use hashbrown::HashMap; -// TODO: via conf -/// Timeout of receiving any WebSocket messages from client. -pub const CLIENT_IDLE_TIMEOUT: Duration = Duration::from_secs(10); +use crate::api::client::{Event, RpcConnection}; +use crate::api::control::member::Id as MemberId; +use crate::media::peer::{Id as PeerId, PeerMachine}; -/// Long-running WebSocket connection of Client API. #[derive(Debug)] -#[allow(clippy::module_name_repetitions)] -pub struct WsSession { - /// ID of [`Member`] that WebSocket connection is associated with. - member_id: MemberId, - /// [`Room`] that [`Member`] is associated with. - room: Addr, - - /// Handle for watchdog which checks whether WebSocket client became - /// idle (no `ping` messages received during [`CLIENT_IDLE_TIMEOUT`]). - /// - /// This one should be renewed on any received WebSocket message - /// from client. - idle_handler: Option, - - /// Indicates whether WebSocket connection is closed by server ot by - /// client. - closed_by_server: bool, -} - -impl WsSession { - /// Creates new [`WsSession`] for specified [`Member`]. - pub fn new(member_id: MemberId, room: Addr) -> Self { - Self { +pub struct Session { + pub member_id: MemberId, + pub connection: Box, + pub peers: HashMap, +} + +impl Session { + pub fn new( + member_id: MemberId, + connection: Box, + ) -> Self { + Session { member_id, - room, - idle_handler: None, - closed_by_server: false, + connection, + peers: HashMap::new(), } } - /// Resets idle handler watchdog. - fn reset_idle_timeout(&mut self, ctx: &mut ::Context) { - if let Some(handler) = self.idle_handler { - ctx.cancel_future(handler); - } - - self.idle_handler = - Some(ctx.run_later(CLIENT_IDLE_TIMEOUT, |sess, ctx| { - info!("WsConnection with member {} is idle", sess.member_id); - - let member_id = sess.member_id; - ctx.wait(wrap_future( - sess.room - .send(RpcConnectionClosed { - member_id, - reason: RpcConnectionClosedReason::Idle, - }) - .map_err(move |err| { - error!( - "WsSession of member {} failed to remove from \ - Room, because: {:?}", - member_id, err, - ) - }), - )); - - ctx.notify(Close { - reason: Some(ws::CloseCode::Normal.into()), - }); - })); + pub fn add_peer(&mut self, peer: PeerMachine) { + self.peers.insert(peer.id(), peer); } -} - -/// [`Actor`] implementation that provides an ergonomic way to deal with -/// WebSocket connection lifecycle for [`WsSession`]. -impl Actor for WsSession { - type Context = ws::WebsocketContext; - /// Starts [`Heartbeat`] mechanism and sends [`RpcConnectionEstablished`] - /// signal to the [`Room`]. - fn started(&mut self, ctx: &mut Self::Context) { - debug!("Started WsSession for member {}", self.member_id); - - self.reset_idle_timeout(ctx); - - let member_id = self.member_id; - ctx.wait(wrap_future( - self.room - .send(RpcConnectionEstablished { - member_id: self.member_id, - connection: Box::new(ctx.address()), - }) - .map(|_| ()) - .map_err(move |err| { - error!( - "WsSession of member {} failed to join Room, \ - because: {:?}", - member_id, err, - ) - }), - )); + pub fn remove_peer(&mut self, peer_id: PeerId) -> Option { + self.peers.remove(&peer_id) } - fn stopped(&mut self, _ctx: &mut Self::Context) { - debug!("Stopped WsSession for member {}", self.member_id); + pub fn send_event( + &self, + event: Event, + ) -> Box> { + self.connection.send_event(event) } -} -impl RpcConnection for Addr { - /// Closes [`WsSession`] by sending itself "normal closure" close message. - fn close(&mut self) -> Box> { - let fut = self - .send(Close { - reason: Some(ws::CloseCode::Normal.into()), - }) - .map_err(|_| ()); - Box::new(fut) - } -} - -/// Message for closing [`WsSession`]. -#[derive(Message)] -pub struct Close { - reason: Option, -} - -impl Handler for WsSession { - type Result = (); - - /// Closes WebSocket connection and stops [`Actor`] of [`WsSession`]. - fn handle(&mut self, close: Close, ctx: &mut Self::Context) { - debug!("Closing WsSession for member {}", self.member_id); - self.closed_by_server = true; - ctx.close(close.reason); - ctx.stop(); - } -} - -/// Message for keeping client WebSocket connection alive. -#[derive(Debug, Deserialize, Message, Serialize)] -pub enum Heartbeat { - /// `ping` message that WebSocket client is expected to send to the server - /// periodically. - #[serde(rename = "ping")] - Ping(usize), - /// `pong` message that server answers with to WebSocket client in response - /// to received `ping` message. - #[serde(rename = "pong")] - Pong(usize), -} - -impl Handler for WsSession { - type Result = (); - - /// Answers with `Heartbeat::Pong` message to WebSocket client in response - /// to the received `Heartbeat::Ping` message. - fn handle(&mut self, msg: Heartbeat, ctx: &mut Self::Context) { - if let Heartbeat::Ping(n) = msg { - trace!("Received ping: {}", n); - ctx.text(serde_json::to_string(&Heartbeat::Pong(n)).unwrap()) - } - } -} - -impl StreamHandler for WsSession { - /// Handles arbitrary [`ws::Message`] received from WebSocket client. - fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) { - debug!( - "Received WS message: {:?} from member {}", - msg, self.member_id - ); - match msg { - ws::Message::Text(text) => { - self.reset_idle_timeout(ctx); - if let Ok(msg) = serde_json::from_str::(&text) { - ctx.notify(msg); - } - } - ws::Message::Close(reason) => { - if !self.closed_by_server { - debug!( - "Send close frame with reason {:?} for member {}", - reason, self.member_id - ); - let member_id = self.member_id; - ctx.wait(wrap_future( - self.room - .send(RpcConnectionClosed { - member_id: self.member_id, - reason: RpcConnectionClosedReason::Disconnected, - }) - .map_err(move |err| { - error!( - "WsSession of member {} failed to remove \ - from Room, because: {:?}", - member_id, err, - ) - }), - )); - ctx.close(reason); - ctx.stop(); - } - } - _ => error!( - "Unsupported client message from member {}", - self.member_id - ), - } + pub fn set_connection( + &mut self, + connection: Box, + ) -> Box> { + let fut = self.connection.close(); + self.connection = connection; + fut } } diff --git a/src/main.rs b/src/main.rs index bf356a525..6b25126a2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,10 @@ //! Medea media server application. +#[macro_use] +extern crate lazy_static; + use actix::prelude::*; use dotenv::dotenv; -use hashbrown::HashMap; use crate::api::{ client::{server, Room, RoomsRepository}, @@ -14,6 +16,7 @@ mod utils; mod api; mod log; +mod media; fn main() { dotenv().ok(); @@ -24,14 +27,10 @@ fn main() { let sys = System::new("medea"); let members = hashmap! { - 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, + 1 => Member{id: 1, credentials: "responder_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "caller_credentials".to_owned()}, }; - let room = Arbiter::start(move |_| Room { - id: 1, - members, - connections: HashMap::new(), - }); + let room = Arbiter::start(move |_| Room::new(1, members)); let rooms = hashmap! {1 => room}; let rooms_repo = RoomsRepository::new(rooms); diff --git a/src/media/mod.rs b/src/media/mod.rs new file mode 100644 index 000000000..0ca57580e --- /dev/null +++ b/src/media/mod.rs @@ -0,0 +1,9 @@ +pub mod peer; +pub mod track; + +pub use self::{ + peer::{Id as PeerId, Peer, PeerMachine}, + track::{ + AudioSettings, Id as TrackId, Track, TrackMediaType, VideoSettings, + }, +}; diff --git a/src/media/peer.rs b/src/media/peer.rs new file mode 100644 index 000000000..309b5cc84 --- /dev/null +++ b/src/media/peer.rs @@ -0,0 +1,230 @@ +use std::{any::Any, sync::Arc}; + +use hashbrown::HashMap; + +use crate::{ + api::client::Event, + api::control::member::Id as MemberId, + log::prelude::*, + media::track::{DirectionalTrack, Id as TrackId, Track, TrackDirection}, +}; + +#[derive(Debug, Clone, PartialEq)] +pub struct New {} +#[derive(Debug, Clone, PartialEq)] +pub struct WaitLocalSDP {} +#[derive(Debug, Clone, PartialEq)] +pub struct WaitLocalHaveRemote {} +#[derive(Debug, Clone, PartialEq)] +pub struct WaitRemoteSDP {} +#[derive(Debug, Clone, PartialEq)] +pub struct Stable {} +#[derive(Debug, Clone, PartialEq)] +pub struct Finished {} +#[derive(Debug, Clone, PartialEq)] +pub struct Failure {} + +/// Implementation state machine for [`Peer`]. +#[derive(Debug, Clone)] +pub enum PeerMachine { + New(Peer), + WaitLocalSDP(Peer), + WaitLocalHaveRemote(Peer), + WaitRemoteSDP(Peer), + Stable(Peer), + Finished(Peer), + Failure(Peer), +} + +impl PeerMachine { + pub fn member_id(&self) -> MemberId { + match self { + PeerMachine::New(peer) => peer.member_id(), + PeerMachine::WaitLocalSDP(peer) => peer.member_id(), + PeerMachine::WaitLocalHaveRemote(peer) => peer.member_id(), + PeerMachine::WaitRemoteSDP(peer) => peer.member_id(), + PeerMachine::Stable(peer) => peer.member_id(), + PeerMachine::Finished(peer) => peer.member_id(), + PeerMachine::Failure(peer) => peer.member_id(), + } + } + + pub fn id(&self) -> Id { + match self { + PeerMachine::New(peer) => peer.id(), + PeerMachine::WaitLocalSDP(peer) => peer.id(), + PeerMachine::WaitLocalHaveRemote(peer) => peer.id(), + PeerMachine::WaitRemoteSDP(peer) => peer.id(), + PeerMachine::Stable(peer) => peer.id(), + PeerMachine::Finished(peer) => peer.id(), + PeerMachine::Failure(peer) => peer.id(), + } + } + + pub fn opponent_id(&self) -> Id { + match self { + PeerMachine::New(peer) => peer.opponent_id(), + PeerMachine::WaitLocalSDP(peer) => peer.opponent_id(), + PeerMachine::WaitLocalHaveRemote(peer) => peer.opponent_id(), + PeerMachine::WaitRemoteSDP(peer) => peer.opponent_id(), + PeerMachine::Stable(peer) => peer.opponent_id(), + PeerMachine::Finished(peer) => peer.opponent_id(), + PeerMachine::Failure(peer) => peer.opponent_id(), + } + } +} + +/// ID of [`Peer`]. +pub type Id = u64; + +#[derive(Debug, Clone)] +pub struct PeerContext { + id: Id, + opponent_id: Id, + member_id: MemberId, + sdp_offer: Option, + sdp_answer: Option, + receivers: HashMap>, + senders: HashMap>, +} + +/// [`RTCPeerConnection`] representation. +#[derive(Debug, Clone)] +pub struct Peer { + context: PeerContext, + state: S, +} + +impl Peer { + pub fn member_id(&self) -> MemberId { + self.context.member_id + } + + pub fn id(&self) -> Id { + self.context.id + } + + pub fn opponent_id(&self) -> Id { + self.context.opponent_id + } + + pub fn tracks(&self) -> Vec { + let tracks = self.context.senders.iter().fold( + vec![], + |mut tracks, (id, track)| { + tracks.push(DirectionalTrack { + id: track.id, + media_type: track.media_type.clone(), + direction: TrackDirection::Send { + receivers: vec![self.context.opponent_id], + }, + }); + tracks + }, + ); + self.context + .receivers + .iter() + .fold(tracks, |mut tracks, (_, track)| { + tracks.push(DirectionalTrack { + id: track.id, + media_type: track.media_type.clone(), + direction: TrackDirection::Recv { + sender: self.context.opponent_id, + }, + }); + tracks + }) + } +} + +impl Peer { + /// Creates new [`Peer`] for [`Member`]. + pub fn new(id: Id, member_id: MemberId, opponent_id: Id) -> Self { + let context = PeerContext { + id, + opponent_id, + member_id, + sdp_offer: None, + sdp_answer: None, + receivers: HashMap::new(), + senders: HashMap::new(), + }; + Peer { + context, + state: New {}, + } + } + + /// Sends PeerCreated event to Web Client and puts [`Peer`] into state + /// of waiting for local offer. + pub fn start(self) -> Peer { + Peer { + context: self.context, + state: WaitLocalSDP {}, + } + } + + /// Sends PeerCreated event with local offer to Web Client and puts [`Peer`] + /// into state of waiting for remote offer. + pub fn set_remote_sdp( + self, + sdp_offer: String, + ) -> Peer { + let mut context = self.context; + context.sdp_offer = Some(sdp_offer); + Peer { + context, + state: WaitLocalHaveRemote {}, + } + } + + pub fn add_sender(&mut self, track: Arc) { + self.context.senders.insert(track.id, track); + } + + pub fn add_receiver(&mut self, track: Arc) { + self.context.receivers.insert(track.id, track); + } +} + +#[test] +fn create_peer() { + let peer = Peer::new(1, 1, 2); + let peer = peer.start(); + + assert_eq!(peer.state, WaitLocalSDP {}); +} + +impl Peer { + pub fn set_local_sdp(self, sdp_offer: String) -> Peer { + let mut context = self.context; + context.sdp_offer = Some(sdp_offer); + Peer { + context, + state: WaitRemoteSDP {}, + } + } +} + +impl Peer { + pub fn set_remote_sdp(self, sdp_answer: String) -> Peer { + let mut context = self.context; + context.sdp_answer = Some(sdp_answer.clone()); + Peer { + context, + state: Stable {}, + } + } +} + +impl Peer { + pub fn set_local_sdp(self, sdp_answer: String) -> Peer { + let mut context = self.context; + context.sdp_answer = Some(sdp_answer); + Peer { + context, + state: Stable {}, + } + } +} diff --git a/src/media/track.rs b/src/media/track.rs new file mode 100644 index 000000000..44a371ed8 --- /dev/null +++ b/src/media/track.rs @@ -0,0 +1,48 @@ +use serde::{Deserialize, Serialize}; + +use crate::media::peer::Id as PeerID; + +/// ID of [`Track`]. +pub type Id = u64; + +/// [`MediaStreamTrack`] representation. +#[derive(Debug)] +pub struct Track { + pub id: Id, + pub media_type: TrackMediaType, +} + +impl Track { + /// Creates new [`Track`] of the specified type. + pub fn new(id: Id, media_type: TrackMediaType) -> Track { + Track { id, media_type } + } +} + +/// [`Track] with specified direction. +#[derive(Debug, Deserialize, Serialize)] +pub struct DirectionalTrack { + pub id: Id, + pub media_type: TrackMediaType, + pub direction: TrackDirection, +} + +/// Direction of [`Track`]. +#[derive(Debug, Deserialize, Serialize)] +pub enum TrackDirection { + Send { receivers: Vec }, + Recv { sender: PeerID }, +} + +/// Type of [`Track`]. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum TrackMediaType { + Audio(AudioSettings), + Video(VideoSettings), +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct AudioSettings {} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct VideoSettings {} From 756f293794ef1566cc5562dcb1e74331bc3f5f2b Mon Sep 17 00:00:00 2001 From: Kirguir Date: Wed, 20 Mar 2019 15:53:34 +0200 Subject: [PATCH 051/179] Impl handle Command::MakeSdpOffer --- src/api/client/commands.rs | 25 ++++++ src/api/client/connection.rs | 30 ++++++- src/api/client/mod.rs | 5 +- src/api/client/room.rs | 162 ++++++++++++++++++++++++++++++----- src/media/mod.rs | 2 +- src/media/peer.rs | 73 ++++++++++------ 6 files changed, 242 insertions(+), 55 deletions(-) create mode 100644 src/api/client/commands.rs diff --git a/src/api/client/commands.rs b/src/api/client/commands.rs new file mode 100644 index 000000000..36e5ad777 --- /dev/null +++ b/src/api/client/commands.rs @@ -0,0 +1,25 @@ +use actix::Message; +use serde::{Deserialize, Serialize}; + +use crate::{api::client::RoomError, media::peer::Id as PeerId}; + +/// WebSocket message from Web Client to Media Server. +#[derive(Debug, Deserialize, Message, Serialize)] +#[rtype(result = "Result<(), RoomError>")] +pub enum Command { + /// Web Client sends SDP Offer. + MakeSdpOffer { + peer_id: PeerId, + sdp_offer: String, + }, + /// Web Client sends SDP Answer. + MakeSdpAnswer { + peer_id: PeerId, + sdp_answer: String, + }, + + SetIceCandidate { + peer_id: PeerId, + candidate: String, + }, +} diff --git a/src/api/client/connection.rs b/src/api/client/connection.rs index 068c1be5a..f48d1fac3 100644 --- a/src/api/client/connection.rs +++ b/src/api/client/connection.rs @@ -7,13 +7,14 @@ use actix::{ Message, SpawnHandle, StreamHandler, }; use actix_web::ws::{self, CloseReason}; -use futures::Future; +use futures::future::{self, Future}; use serde::{Deserialize, Serialize}; use crate::{ api::client::{ - Event, Room, RpcConnection, RpcConnectionClosed, - RpcConnectionClosedReason, RpcConnectionEstablished, + Command, Event, MemberCommand, Room, RpcConnection, + RpcConnectionClosed, RpcConnectionClosedReason, + RpcConnectionEstablished, }, api::control::member::Id as MemberId, log::prelude::*, @@ -211,6 +212,29 @@ impl StreamHandler for WsConnection { if let Ok(msg) = serde_json::from_str::(&text) { ctx.notify(msg); } + if let Ok(command) = serde_json::from_str::(&text) { + let member_id = self.member_id; + let command = MemberCommand { + member_id: self.member_id, + command, + }; + ctx.wait(wrap_future( + self.room + .send(command) + .and_then(move |res| match res { + Ok(_) => future::ok(()), + Err(err) => { + error!( + "Command from member {} handle \ + failed, because: {:?}", + member_id, err, + ); + future::ok(()) + } + }) + .map_err(|_| ()), + )); + } } ws::Message::Close(reason) => { if !self.closed_by_server { diff --git a/src/api/client/mod.rs b/src/api/client/mod.rs index 63b44794b..0512f3191 100644 --- a/src/api/client/mod.rs +++ b/src/api/client/mod.rs @@ -1,9 +1,12 @@ //! Implementation of Client API. +pub mod commands; pub mod connection; pub mod events; pub mod room; pub mod server; pub mod session; -pub use self::{connection::*, events::*, room::*, server::*, session::*}; +pub use self::{ + commands::*, connection::*, events::*, room::*, server::*, session::*, +}; diff --git a/src/api/client/room.rs b/src/api/client/room.rs index d1b1db5f7..bebfc4288 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -9,18 +9,19 @@ use actix::{ fut::wrap_future, Actor, ActorFuture, Addr, AsyncContext, Context, Handler, Message, }; +use failure::Fail; use futures::{ - future::{self, join_all, Either}, + future::{self, Either}, Future, }; use hashbrown::HashMap; use crate::{ - api::client::{Event, Session}, + api::client::{Command, Event, Session}, api::control::{Id as MemberId, Member}, log::prelude::*, media::{ - peer::{Id as PeerId, Peer, PeerMachine}, + peer::{Id as PeerId, Peer, PeerMachine, Transceiver}, track::{ AudioSettings, Id as TrackId, Track, TrackMediaType, VideoSettings, }, @@ -38,6 +39,20 @@ fn next_peer_id() -> PeerId { *index } +#[derive(Fail, Debug)] +pub enum RoomError { + #[fail(display = "Member without peer {}", _0)] + MemberWithoutPeer(MemberId), + #[fail(display = "Invalid connection of member {}", _0)] + InvalidConnection(MemberId), + #[fail(display = "Unknown peer {}", _0)] + UnknownPeer(PeerId), + #[fail(display = "Peer dont have opponent {}", _0)] + NoOpponentPeer(PeerId), + #[fail(display = "Unmatched state of peer {}", _0)] + UnmatchedState(PeerId), +} + /// ID of [`Room`]. pub type Id = u64; @@ -64,31 +79,83 @@ impl Room { } } - pub fn session_by_peer( - &mut self, - peer_id: PeerId, - ) -> Option<(&u64, &mut Session)> { - self.sessions - .iter_mut() - .find(|(_, s)| s.peers.contains_key(&peer_id)) - } - pub fn remove_session(&mut self, member_id: MemberId) { if let Some(session) = self.sessions.remove(&member_id) { for peer in session.peers.values() { - let opponent_peer_id = peer.opponent_id(); - if let Some((_, opp_session)) = - self.session_by_peer(opponent_peer_id) + if let Some(transceiver_session) = + self.sessions.get_mut(&peer.transceiver().member_id) { info!( "Remove peer {:?} of member {:?}", - opponent_peer_id, opp_session.member_id + peer.transceiver().peer_id, + peer.transceiver().member_id ); - opp_session.remove_peer(opponent_peer_id); + transceiver_session.remove_peer(peer.transceiver().peer_id); } } } } + + fn handle_make_sdp_offer( + &mut self, + from_member_id: MemberId, + from_peer_id: PeerId, + sdp_offer: String, + ) -> Result { + let from_session = self + .sessions + .get_mut(&from_member_id) + .ok_or(RoomError::UnknownPeer(from_member_id))?; + let from_peer = from_session + .remove_peer(from_peer_id) + .ok_or(RoomError::UnknownPeer(from_member_id))?; + let transceiver = match from_peer { + PeerMachine::WaitLocalSDP(peer) => { + let from_peer = peer.set_local_sdp(sdp_offer.clone()); + let trans = from_peer.transceiver(); + from_session.add_peer(PeerMachine::WaitRemoteSDP(from_peer)); + Ok(trans) + } + _ => { + let peer_id = from_peer.id(); + error!("Unmatched state caller peer {}", peer_id); + from_session.add_peer(from_peer); + Err(RoomError::UnmatchedState(peer_id)) + } + }?; + + let to_session = self + .sessions + .get_mut(&transceiver.member_id) + .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; + let to_peer = to_session + .remove_peer(transceiver.peer_id) + .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; + + let event = match to_peer { + PeerMachine::New(peer) => { + let to_peer = peer.set_remote_sdp(sdp_offer.clone()); + let event = MemberEvent { + member_id: transceiver.member_id, + event: Event::PeerCreated { + peer_id: to_peer.id(), + sdp_offer: Some(sdp_offer), + tracks: to_peer.tracks(), + }, + }; + to_session.add_peer(PeerMachine::WaitLocalHaveRemote(to_peer)); + Ok(event) + } + _ => { + let peer_id = to_peer.id(); + error!("Unmatched state responder peer {}", peer_id); + to_session.add_peer(to_peer); + Err(RoomError::UnmatchedState(peer_id)) + } + }?; + + Ok(event) + } } /// [`Actor`] implementation that provides an ergonomic way @@ -215,10 +282,22 @@ fn start_pipeline(caller: &mut Session, callee: &mut Session) -> Event { ); let caller_peer_id = next_peer_id(); let callee_peer_id = next_peer_id(); - let mut caller_peer = - Peer::new(caller_peer_id, caller.member_id, callee_peer_id); - let mut callee_peer = - Peer::new(callee_peer_id, callee.member_id, caller_peer_id); + let mut caller_peer = Peer::new( + caller_peer_id, + caller.member_id, + Transceiver { + member_id: callee.member_id, + peer_id: callee_peer_id, + }, + ); + let mut callee_peer = Peer::new( + callee_peer_id, + callee.member_id, + Transceiver { + member_id: caller.member_id, + peer_id: caller_peer_id, + }, + ); let track_audio = Arc::new(Track::new(1, TrackMediaType::Audio(AudioSettings {}))); @@ -240,10 +319,49 @@ fn start_pipeline(caller: &mut Session, callee: &mut Session) -> Event { let callee_peer = PeerMachine::New(callee_peer); callee.add_peer(callee_peer); - info!("Send event: {:?}", event); event } +#[derive(Debug, Message)] +#[rtype(result = "Result<(), RoomError>")] +pub struct MemberCommand { + pub member_id: MemberId, + pub command: Command, +} + +impl Handler for Room { + type Result = ActFuture<(), RoomError>; + + /// Receives [`Command`] from Web client and changes state of interconnected + /// [`Peer`]s. + fn handle( + &mut self, + msg: MemberCommand, + ctx: &mut Self::Context, + ) -> Self::Result { + debug!("receive command: {:?}", msg); + let fut = match msg.command { + Command::MakeSdpOffer { peer_id, sdp_offer } => future::done( + self.handle_make_sdp_offer(msg.member_id, peer_id, sdp_offer) + .map(|event| ctx.notify(event)), + ), + _ => future::ok(()), /* Command::MakeSdpAnswer { + * peer_id, + * sdp_answer, + * } => future::done(self. + * handle_make_sdp_answer(peer_id, + * sdp_answer)), + * Command::SetIceCandidate { peer_id, + * candidate } => { + * future::done(self. + * handle_set_ice_candidate(peer_id, + * candidate)) + * } */ + }; + Box::new(wrap_future(fut)) + } +} + /// Signal of existing [`RpcConnection`] of specified [`Member`] being closed. #[derive(Debug, Message)] pub struct RpcConnectionClosed { diff --git a/src/media/mod.rs b/src/media/mod.rs index 0ca57580e..ef2a48515 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -2,7 +2,7 @@ pub mod peer; pub mod track; pub use self::{ - peer::{Id as PeerId, Peer, PeerMachine}, + peer::{Id as PeerId, Peer, PeerMachine, Transceiver}, track::{ AudioSettings, Id as TrackId, Track, TrackMediaType, VideoSettings, }, diff --git a/src/media/peer.rs b/src/media/peer.rs index 309b5cc84..b582b9a91 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -3,29 +3,28 @@ use std::{any::Any, sync::Arc}; use hashbrown::HashMap; use crate::{ - api::client::Event, api::control::member::Id as MemberId, log::prelude::*, media::track::{DirectionalTrack, Id as TrackId, Track, TrackDirection}, }; -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct New {} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct WaitLocalSDP {} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct WaitLocalHaveRemote {} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct WaitRemoteSDP {} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct Stable {} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct Finished {} -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, PartialEq)] pub struct Failure {} /// Implementation state machine for [`Peer`]. -#[derive(Debug, Clone)] +#[derive(Debug)] pub enum PeerMachine { New(Peer), WaitLocalSDP(Peer), @@ -61,26 +60,44 @@ impl PeerMachine { } } - pub fn opponent_id(&self) -> Id { + pub fn transceiver(&self) -> Transceiver { + match self { + PeerMachine::New(peer) => peer.transceiver(), + PeerMachine::WaitLocalSDP(peer) => peer.transceiver(), + PeerMachine::WaitLocalHaveRemote(peer) => peer.transceiver(), + PeerMachine::WaitRemoteSDP(peer) => peer.transceiver(), + PeerMachine::Stable(peer) => peer.transceiver(), + PeerMachine::Finished(peer) => peer.transceiver(), + PeerMachine::Failure(peer) => peer.transceiver(), + } + } + + pub fn tracks(&self) -> Vec { match self { - PeerMachine::New(peer) => peer.opponent_id(), - PeerMachine::WaitLocalSDP(peer) => peer.opponent_id(), - PeerMachine::WaitLocalHaveRemote(peer) => peer.opponent_id(), - PeerMachine::WaitRemoteSDP(peer) => peer.opponent_id(), - PeerMachine::Stable(peer) => peer.opponent_id(), - PeerMachine::Finished(peer) => peer.opponent_id(), - PeerMachine::Failure(peer) => peer.opponent_id(), + PeerMachine::New(peer) => peer.tracks(), + PeerMachine::WaitLocalSDP(peer) => peer.tracks(), + PeerMachine::WaitLocalHaveRemote(peer) => peer.tracks(), + PeerMachine::WaitRemoteSDP(peer) => peer.tracks(), + PeerMachine::Stable(peer) => peer.tracks(), + PeerMachine::Finished(peer) => peer.tracks(), + PeerMachine::Failure(peer) => peer.tracks(), } } } +#[derive(Debug, Clone)] +pub struct Transceiver { + pub member_id: MemberId, + pub peer_id: Id, +} + /// ID of [`Peer`]. pub type Id = u64; -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct PeerContext { id: Id, - opponent_id: Id, + transceiver: Transceiver, member_id: MemberId, sdp_offer: Option, sdp_answer: Option, @@ -89,7 +106,7 @@ pub struct PeerContext { } /// [`RTCPeerConnection`] representation. -#[derive(Debug, Clone)] +#[derive(Debug)] pub struct Peer { context: PeerContext, state: S, @@ -104,19 +121,19 @@ impl Peer { self.context.id } - pub fn opponent_id(&self) -> Id { - self.context.opponent_id + pub fn transceiver(&self) -> Transceiver { + self.context.transceiver.clone() } pub fn tracks(&self) -> Vec { let tracks = self.context.senders.iter().fold( vec![], - |mut tracks, (id, track)| { + |mut tracks, (_, track)| { tracks.push(DirectionalTrack { id: track.id, media_type: track.media_type.clone(), direction: TrackDirection::Send { - receivers: vec![self.context.opponent_id], + receivers: vec![self.context.transceiver.peer_id], }, }); tracks @@ -130,7 +147,7 @@ impl Peer { id: track.id, media_type: track.media_type.clone(), direction: TrackDirection::Recv { - sender: self.context.opponent_id, + sender: self.context.transceiver.peer_id, }, }); tracks @@ -140,10 +157,10 @@ impl Peer { impl Peer { /// Creates new [`Peer`] for [`Member`]. - pub fn new(id: Id, member_id: MemberId, opponent_id: Id) -> Self { + pub fn new(id: Id, member_id: MemberId, transceiver: Transceiver) -> Self { let context = PeerContext { id, - opponent_id, + transceiver, member_id, sdp_offer: None, sdp_answer: None, @@ -190,7 +207,7 @@ impl Peer { #[test] fn create_peer() { - let peer = Peer::new(1, 1, 2); + let peer = Peer::new(1, 1, Transceiver(2, 2)); let peer = peer.start(); assert_eq!(peer.state, WaitLocalSDP {}); From 90201da7505a83a49877233ceda241fefa6efc93 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 21 Mar 2019 17:24:35 +0200 Subject: [PATCH 052/179] Impl return future by handler Command --- signaling_test.html | 163 ++++++++++++++++++++++ src/api/client/commands.rs | 8 +- src/api/client/connection.rs | 11 +- src/api/client/events.rs | 5 +- src/api/client/room.rs | 258 ++++++++++++++++++++++++----------- src/api/client/session.rs | 6 +- src/main.rs | 4 +- 7 files changed, 363 insertions(+), 92 deletions(-) create mode 100644 signaling_test.html diff --git a/signaling_test.html b/signaling_test.html new file mode 100644 index 000000000..53d3a2cb1 --- /dev/null +++ b/signaling_test.html @@ -0,0 +1,163 @@ + + + + Chat + + + + + +
+
+
+ +
+
+ +
+
+
+ + diff --git a/src/api/client/commands.rs b/src/api/client/commands.rs index 36e5ad777..504f77a58 100644 --- a/src/api/client/commands.rs +++ b/src/api/client/commands.rs @@ -1,7 +1,10 @@ use actix::Message; use serde::{Deserialize, Serialize}; -use crate::{api::client::RoomError, media::peer::Id as PeerId}; +use crate::{ + api::client::RoomError, api::control::Id as MemberId, + media::peer::Id as PeerId, +}; /// WebSocket message from Web Client to Media Server. #[derive(Debug, Deserialize, Message, Serialize)] @@ -9,16 +12,19 @@ use crate::{api::client::RoomError, media::peer::Id as PeerId}; pub enum Command { /// Web Client sends SDP Offer. MakeSdpOffer { + member_id: MemberId, peer_id: PeerId, sdp_offer: String, }, /// Web Client sends SDP Answer. MakeSdpAnswer { + member_id: MemberId, peer_id: PeerId, sdp_answer: String, }, SetIceCandidate { + member_id: MemberId, peer_id: PeerId, candidate: String, }, diff --git a/src/api/client/connection.rs b/src/api/client/connection.rs index f48d1fac3..81c232fa4 100644 --- a/src/api/client/connection.rs +++ b/src/api/client/connection.rs @@ -12,9 +12,8 @@ use serde::{Deserialize, Serialize}; use crate::{ api::client::{ - Command, Event, MemberCommand, Room, RpcConnection, - RpcConnectionClosed, RpcConnectionClosedReason, - RpcConnectionEstablished, + Command, Event, Room, RpcConnection, RpcConnectionClosed, + RpcConnectionClosedReason, RpcConnectionEstablished, }, api::control::member::Id as MemberId, log::prelude::*, @@ -214,10 +213,6 @@ impl StreamHandler for WsConnection { } if let Ok(command) = serde_json::from_str::(&text) { let member_id = self.member_id; - let command = MemberCommand { - member_id: self.member_id, - command, - }; ctx.wait(wrap_future( self.room .send(command) @@ -258,7 +253,7 @@ impl StreamHandler for WsConnection { }), )); ctx.close(reason); - ctx.stop(); + // ctx.stop(); } } _ => error!( diff --git a/src/api/client/events.rs b/src/api/client/events.rs index 377fcc7c8..11228f450 100644 --- a/src/api/client/events.rs +++ b/src/api/client/events.rs @@ -1,7 +1,10 @@ use actix::Message; use serde::{Deserialize, Serialize}; -use crate::media::{peer::Id as PeerId, track::DirectionalTrack}; +use crate::{ + api::control::member::Id as MemberId, + media::{peer::Id as PeerId, track::DirectionalTrack}, +}; /// WebSocket message from Media Server to Web Client. #[derive(Debug, Deserialize, Message, Serialize)] diff --git a/src/api/client/room.rs b/src/api/client/room.rs index bebfc4288..99fde54af 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -11,7 +11,7 @@ use actix::{ }; use failure::Fail; use futures::{ - future::{self, Either}, + future::{self, join_all, Either}, Future, }; use hashbrown::HashMap; @@ -27,6 +27,7 @@ use crate::{ }, }, }; +use slog::Error; lazy_static! { static ref PEER_INDEX: Mutex = Mutex::new(0); @@ -51,6 +52,8 @@ pub enum RoomError { NoOpponentPeer(PeerId), #[fail(display = "Unmatched state of peer {}", _0)] UnmatchedState(PeerId), + #[fail(display = "Cannot send event to member {}", _0)] + FailedSendEvent(MemberId), } /// ID of [`Room`]. @@ -90,7 +93,8 @@ impl Room { peer.transceiver().peer_id, peer.transceiver().member_id ); - transceiver_session.remove_peer(peer.transceiver().peer_id); + transceiver_session + .remove_peer(&peer.transceiver().peer_id); } } } @@ -101,14 +105,14 @@ impl Room { from_member_id: MemberId, from_peer_id: PeerId, sdp_offer: String, - ) -> Result { + ) -> Result<(MemberId, Event), RoomError> { let from_session = self .sessions .get_mut(&from_member_id) - .ok_or(RoomError::UnknownPeer(from_member_id))?; + .ok_or(RoomError::UnknownPeer(from_peer_id))?; let from_peer = from_session - .remove_peer(from_peer_id) - .ok_or(RoomError::UnknownPeer(from_member_id))?; + .remove_peer(&from_peer_id) + .ok_or(RoomError::UnknownPeer(from_peer_id))?; let transceiver = match from_peer { PeerMachine::WaitLocalSDP(peer) => { let from_peer = peer.set_local_sdp(sdp_offer.clone()); @@ -129,19 +133,16 @@ impl Room { .get_mut(&transceiver.member_id) .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; let to_peer = to_session - .remove_peer(transceiver.peer_id) + .remove_peer(&transceiver.peer_id) .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; let event = match to_peer { PeerMachine::New(peer) => { let to_peer = peer.set_remote_sdp(sdp_offer.clone()); - let event = MemberEvent { - member_id: transceiver.member_id, - event: Event::PeerCreated { - peer_id: to_peer.id(), - sdp_offer: Some(sdp_offer), - tracks: to_peer.tracks(), - }, + let event = Event::PeerCreated { + peer_id: to_peer.id(), + sdp_offer: Some(sdp_offer), + tracks: to_peer.tracks(), }; to_session.add_peer(PeerMachine::WaitLocalHaveRemote(to_peer)); Ok(event) @@ -154,7 +155,120 @@ impl Room { } }?; - Ok(event) + Ok((to_session.member_id, event)) + } + + fn handle_make_sdp_answer( + &mut self, + from_member_id: MemberId, + from_peer_id: PeerId, + sdp_answer: String, + ) -> Result<(MemberId, Event), RoomError> { + let from_session = self + .sessions + .get_mut(&from_member_id) + .ok_or(RoomError::UnknownPeer(from_peer_id))?; + let from_peer = from_session + .remove_peer(&from_peer_id) + .ok_or(RoomError::UnknownPeer(from_peer_id))?; + let transceiver = match from_peer { + PeerMachine::WaitLocalHaveRemote(peer) => { + let from_peer = peer.set_local_sdp(sdp_answer.clone()); + let trans = from_peer.transceiver(); + from_session.add_peer(PeerMachine::Stable(from_peer)); + Ok(trans) + } + _ => { + let peer_id = from_peer.id(); + error!("Unmatched state caller peer {}", peer_id); + from_session.add_peer(from_peer); + Err(RoomError::UnmatchedState(peer_id)) + } + }?; + + let to_session = self + .sessions + .get_mut(&transceiver.member_id) + .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; + let to_peer = to_session + .remove_peer(&transceiver.peer_id) + .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; + + let event = match to_peer { + PeerMachine::WaitRemoteSDP(peer) => { + let to_peer = peer.set_remote_sdp(sdp_answer.clone()); + let event = Event::PeerCreated { + peer_id: to_peer.id(), + sdp_offer: Some(sdp_answer), + tracks: to_peer.tracks(), + }; + to_session.add_peer(PeerMachine::Stable(to_peer)); + Ok(event) + } + _ => { + let peer_id = to_peer.id(); + error!("Unmatched state responder peer {}", peer_id); + to_session.add_peer(to_peer); + Err(RoomError::UnmatchedState(peer_id)) + } + }?; + + Ok((to_session.member_id, event)) + } + + fn handle_set_ice_candidate( + &mut self, + from_member_id: MemberId, + from_peer_id: PeerId, + candidate: String, + ) -> Result<(MemberId, Event), RoomError> { + let from_session = self + .sessions + .get_mut(&from_member_id) + .ok_or(RoomError::UnknownPeer(from_peer_id))?; + let from_peer = from_session + .remove_peer(&from_peer_id) + .ok_or(RoomError::UnknownPeer(from_peer_id))?; + let transceiver = match from_peer { + PeerMachine::WaitLocalSDP(_) + | PeerMachine::WaitLocalHaveRemote(_) + | PeerMachine::WaitRemoteSDP(_) + | PeerMachine::Stable(_) => Ok(from_peer.transceiver()), + _ => Err(RoomError::UnmatchedState(from_peer_id)), + }?; + let to_session = self + .sessions + .get_mut(&transceiver.member_id) + .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; + let to_peer = to_session + .remove_peer(&transceiver.peer_id) + .ok_or(RoomError::UnknownPeer(transceiver.peer_id))?; + + let event = Event::IceCandidateDiscovered { + peer_id: to_peer.id(), + candidate, + }; + + Ok((to_session.member_id, event)) + } + + fn send_event( + &self, + member_id: MemberId, + event: Event, + ) -> Box> { + info!("Send event {:?} to member {}", event, member_id); + let fut = match self.sessions.get(&member_id) { + Some(session) => Either::A( + session + .send_event(event) + .map_err(move |_| RoomError::FailedSendEvent(member_id)), + ), + None => { + Either::B(future::err(RoomError::FailedSendEvent(member_id))) + } + }; + Box::new(fut) } } @@ -242,33 +356,28 @@ impl Handler for Room { ) -> Self::Result { info!("RpcConnectionEstablished for member {}", msg.member_id); - let mut fut = Either::A(future::ok(())); + let mut fut; if let Some(session) = self.sessions.get_mut(&msg.member_id) { debug!( "Replaced RpcConnection for member {} session", msg.member_id ); - fut = Either::B(session.set_connection(msg.connection)); + fut = Either::A(session.set_connection(msg.connection)); } else { let member_id = msg.member_id; let mut session = Session::new(msg.member_id, msg.connection); info!("Members in room: {:?}", self.sessions.len()); - let events = self - .sessions - .iter_mut() - .filter(|&(&m_id, _)| m_id != member_id) - .fold(vec![], |mut events, (_, callee)| { - events.push(start_pipeline(&mut session, callee)); - events - }); + let futures = self.sessions.iter_mut().fold( + vec![], + |mut futures, (_, caller)| { + let event = start_pipeline(caller, &mut session); + futures.push(caller.send_event(event)); + futures + }, + ); self.sessions.insert(member_id, session); - events.into_iter().for_each(|e| { - ctx.notify(MemberEvent { - member_id, - event: e, - }) - }) + fut = Either::B(join_all(futures).map(|_| ())); } Box::new(wrap_future(fut)) @@ -322,41 +431,55 @@ fn start_pipeline(caller: &mut Session, callee: &mut Session) -> Event { event } -#[derive(Debug, Message)] -#[rtype(result = "Result<(), RoomError>")] -pub struct MemberCommand { - pub member_id: MemberId, - pub command: Command, -} - -impl Handler for Room { +impl Handler for Room { type Result = ActFuture<(), RoomError>; /// Receives [`Command`] from Web client and changes state of interconnected /// [`Peer`]s. fn handle( &mut self, - msg: MemberCommand, + command: Command, ctx: &mut Self::Context, ) -> Self::Result { - debug!("receive command: {:?}", msg); - let fut = match msg.command { - Command::MakeSdpOffer { peer_id, sdp_offer } => future::done( - self.handle_make_sdp_offer(msg.member_id, peer_id, sdp_offer) - .map(|event| ctx.notify(event)), - ), - _ => future::ok(()), /* Command::MakeSdpAnswer { - * peer_id, - * sdp_answer, - * } => future::done(self. - * handle_make_sdp_answer(peer_id, - * sdp_answer)), - * Command::SetIceCandidate { peer_id, - * candidate } => { - * future::done(self. - * handle_set_ice_candidate(peer_id, - * candidate)) - * } */ + debug!("receive command: {:?}", command); + let fut = match command { + Command::MakeSdpOffer { + member_id, + peer_id, + sdp_offer, + } => { + match self.handle_make_sdp_offer(member_id, peer_id, sdp_offer) + { + Ok((member_id, event)) => { + Either::A(self.send_event(member_id, event)) + } + Err(e) => Either::B(future::err(e)), + } + } + Command::MakeSdpAnswer { + member_id, + peer_id, + sdp_answer, + } => match self + .handle_make_sdp_answer(member_id, peer_id, sdp_answer) + { + Ok((member_id, event)) => { + Either::A(self.send_event(member_id, event)) + } + Err(e) => Either::B(future::err(e)), + }, + Command::SetIceCandidate { + member_id, + peer_id, + candidate, + } => match self + .handle_set_ice_candidate(member_id, peer_id, candidate) + { + Ok((member_id, event)) => { + Either::A(self.send_event(member_id, event)) + } + Err(e) => Either::B(future::err(e)), + }, }; Box::new(wrap_future(fut)) } @@ -393,25 +516,6 @@ impl Handler for Room { } } -#[derive(Debug, Message)] -struct MemberEvent { - member_id: MemberId, - event: Event, -} - -impl Handler for Room { - type Result = (); - - /// Send [`Event`] to specified [`Member`] from the [`Room`]. - fn handle(&mut self, msg: MemberEvent, ctx: &mut Self::Context) { - let member_id = msg.member_id; - info!("Send event {:?} for member {}", msg.event, msg.member_id); - if let Some(session) = self.sessions.get(&member_id) { - ctx.wait(wrap_future(session.send_event(msg.event))) - } - } -} - /// Repository that stores [`Room`]s. #[derive(Clone, Default)] pub struct RoomsRepository { diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 54f5bd40d..bcbe76a36 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -8,7 +8,7 @@ use crate::media::peer::{Id as PeerId, PeerMachine}; #[derive(Debug)] pub struct Session { pub member_id: MemberId, - pub connection: Box, + connection: Box, pub peers: HashMap, } @@ -28,8 +28,8 @@ impl Session { self.peers.insert(peer.id(), peer); } - pub fn remove_peer(&mut self, peer_id: PeerId) -> Option { - self.peers.remove(&peer_id) + pub fn remove_peer(&mut self, peer_id: &PeerId) -> Option { + self.peers.remove(peer_id) } pub fn send_event( diff --git a/src/main.rs b/src/main.rs index 6b25126a2..3721dc175 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,8 +27,8 @@ fn main() { let sys = System::new("medea"); let members = hashmap! { - 1 => Member{id: 1, credentials: "responder_credentials".to_owned()}, - 2 => Member{id: 2, credentials: "caller_credentials".to_owned()}, + 1 => Member{id: 1, credentials: "caller_credentials".to_owned()}, + 2 => Member{id: 2, credentials: "responder_credentials".to_owned()}, }; let room = Arbiter::start(move |_| Room::new(1, members)); let rooms = hashmap! {1 => room}; From bda5ba2b5b8b02e3d807549885c4768d31bf8247 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Fri, 22 Mar 2019 14:46:06 +0200 Subject: [PATCH 053/179] Fix errors --- signaling_test.html | 40 +++++++++++++++++++++--------------- src/api/client/connection.rs | 22 ++++++++++---------- src/api/client/room.rs | 38 ++++++++++++++-------------------- 3 files changed, 50 insertions(+), 50 deletions(-) diff --git a/signaling_test.html b/signaling_test.html index 53d3a2cb1..18a0e2660 100644 --- a/signaling_test.html +++ b/signaling_test.html @@ -6,12 +6,14 @@ diff --git a/src/api/client/room.rs b/src/api/client/room.rs index 02dbb156b..48cb73ee6 100644 --- a/src/api/client/room.rs +++ b/src/api/client/room.rs @@ -596,23 +596,24 @@ mod test { } } - impl Handler for TestConnection { + impl Handler for TestConnection { type Result = (); - fn handle(&mut self, event: Event, _ctx: &mut Self::Context) { + fn handle(&mut self, msg: RoomMessage, _ctx: &mut Self::Context) { let mut events = self.events.lock().unwrap(); + let event = msg.into(); events.push(serde_json::to_string(&event).unwrap()); - match event { + if let Some(msg) = match event { Event::PeerCreated { peer_id, sdp_offer, tracks: _, } => match sdp_offer { - Some(_) => self.room.do_send(Command::MakeSdpAnswer { + Some(_) => Some(Command::MakeSdpAnswer { peer_id, sdp_answer: "responder_answer".into(), }), - None => self.room.do_send(Command::MakeSdpOffer { + None => Some(Command::MakeSdpOffer { peer_id, sdp_offer: "caller_offer".into(), }), @@ -620,7 +621,7 @@ mod test { Event::SdpAnswerMade { peer_id, sdp_answer: _, - } => self.room.do_send(Command::SetIceCandidate { + } => Some(Command::SetIceCandidate { peer_id, candidate: "ice_candidate".into(), }), @@ -632,8 +633,11 @@ mod test { member_id: self.member_id, reason: ClosedReason::Disconnected, }); + None } - Event::PeersRemoved { peer_ids: _ } => {} + Event::PeersRemoved { peer_ids: _ } => None, + } { + self.room.do_send(MemberMessage::from(msg)) } } } @@ -646,9 +650,9 @@ mod test { fn send_event( &self, - event: Event, + msg: RoomMessage, ) -> Box> { - let fut = self.send(event).map_err(|_| ()); + let fut = self.send(msg).map_err(|_| ()); Box::new(fut) } } From ca1feaf886a5712cbc467797dcb2203e55987eb9 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 7 May 2019 15:11:50 +0300 Subject: [PATCH 162/179] Fix merge --- Cargo.lock | 1 + src/api/client/rpc_connection.rs | 53 +++++++++++++++++++------------- src/api/client/session.rs | 26 ++++++++++------ src/media/errors.rs | 7 ----- src/signalling/participants.rs | 9 +++--- src/signalling/room.rs | 20 ++++++------ 6 files changed, 61 insertions(+), 55 deletions(-) delete mode 100644 src/media/errors.rs diff --git a/Cargo.lock b/Cargo.lock index 47acf898b..2ca5572dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -864,6 +864,7 @@ dependencies = [ "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "smart-default 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] diff --git a/src/api/client/rpc_connection.rs b/src/api/client/rpc_connection.rs index 2516fde27..b5272f7ab 100644 --- a/src/api/client/rpc_connection.rs +++ b/src/api/client/rpc_connection.rs @@ -7,14 +7,16 @@ use crate::api::control::MemberId; use std::fmt; +/// Wrapper [`Command`] for implements actix [`Message`]. macro_attr! { #[derive(Message, NewtypeFrom!)] #[rtype(result = "Result<(), ()>")] - pub struct MemberMessage(Command); + pub struct CommandMessage(Command); } +/// Wrapper [`Event`] for implements actix [`Message`]. macro_attr! { #[derive(Message, NewtypeFrom!)] - pub struct RoomMessage(Event); + pub struct EventMessage(Event); } /// Abstraction over RPC connection with some remote [`Member`]. @@ -27,7 +29,7 @@ pub trait RpcConnection: fmt::Debug + Send { /// Sends [`Event`] to remote [`Member`]. fn send_event( &self, - event: RoomMessage, + msg: EventMessage, ) -> Box>; } @@ -92,15 +94,15 @@ pub mod test { System, }; use futures::future::Future; + use protocol::{Command, Event}; use crate::{ api::{ client::rpc_connection::{ - ClosedReason, RpcConnection, RpcConnectionClosed, - RpcConnectionEstablished, + ClosedReason, CommandMessage, EventMessage, RpcConnection, + RpcConnectionClosed, RpcConnectionEstablished, }, control::MemberId, - protocol::{Command, Event}, }, signalling::Room, }; @@ -145,11 +147,12 @@ pub mod test { } } - impl Handler for TestConnection { + impl Handler for TestConnection { type Result = (); - fn handle(&mut self, event: Event, _ctx: &mut Self::Context) { + fn handle(&mut self, msg: EventMessage, _ctx: &mut Self::Context) { let mut events = self.events.lock().unwrap(); + let event = msg.into(); events.push(serde_json::to_string(&event).unwrap()); match event { Event::PeerCreated { @@ -158,19 +161,25 @@ pub mod test { tracks: _, } => { match sdp_offer { - Some(_) => self.room.do_send(Command::MakeSdpAnswer { - peer_id, - sdp_answer: "responder_answer".into(), - }), - None => self.room.do_send(Command::MakeSdpOffer { - peer_id, - sdp_offer: "caller_offer".into(), - }), + Some(_) => self.room.do_send(CommandMessage::from( + Command::MakeSdpAnswer { + peer_id, + sdp_answer: "responder_answer".into(), + }, + )), + None => self.room.do_send(CommandMessage::from( + Command::MakeSdpOffer { + peer_id, + sdp_offer: "caller_offer".into(), + }, + )), } - self.room.do_send(Command::SetIceCandidate { - peer_id, - candidate: "ice_candidate".into(), - }) + self.room.do_send(CommandMessage::from( + Command::SetIceCandidate { + peer_id, + candidate: "ice_candidate".into(), + }, + )) } Event::IceCandidateDiscovered { peer_id: _, @@ -198,9 +207,9 @@ pub mod test { fn send_event( &self, - event: Event, + msg: EventMessage, ) -> Box> { - let fut = self.send(event).map_err(|_| ()); + let fut = self.send(msg).map_err(|_| ()); Box::new(fut) } } diff --git a/src/api/client/session.rs b/src/api/client/session.rs index 308d9e926..cbe42eb26 100644 --- a/src/api/client/session.rs +++ b/src/api/client/session.rs @@ -13,8 +13,8 @@ use protocol::{ClientMsg, ServerMsg}; use crate::{ api::{ client::rpc_connection::{ - ClosedReason, RpcConnection, RpcConnectionClosed, - RpcConnectionEstablished, + ClosedReason, CommandMessage, EventMessage, RpcConnection, + RpcConnectionClosed, RpcConnectionEstablished, }, control::MemberId, }, @@ -161,10 +161,10 @@ impl RpcConnection for Addr { /// Sends [`Event`] to Web Client. fn send_event( &self, - msg: RoomMessage, + msg: EventMessage, ) -> Box> { let fut = self - .send(ServerMsg::Event(msg.into())) + .send(msg) .map_err(|err| error!("Failed send event {:?} ", err)); Box::new(fut) } @@ -188,13 +188,15 @@ impl Handler for WsSession { } } -impl Handler for WsSession { +impl Handler for WsSession { type Result = (); /// Sends [`Event`] to Web Client. - fn handle(&mut self, msg: ServerMsg, ctx: &mut Self::Context) { - debug!("Event {:?} for member {}", msg, self.member_id); - ctx.text(serde_json::to_string(&msg).unwrap()) + fn handle(&mut self, msg: EventMessage, ctx: &mut Self::Context) { + let event = + serde_json::to_string(&ServerMsg::Event(msg.into())).unwrap(); + debug!("Event {} for member {}", event, self.member_id); + ctx.text(event); } } @@ -212,10 +214,14 @@ impl StreamHandler for WsSession { Ok(ClientMsg::Ping(n)) => { trace!("Received ping: {}", n); // Answer with Heartbeat::Pong. - ctx.notify(ServerMsg::Pong(n)); + ctx.text( + serde_json::to_string(&ServerMsg::Pong(n)).unwrap(), + ); } Ok(ClientMsg::Command(command)) => { - if let Err(err) = self.room.try_send(MemberMessage::from(command)) { + if let Err(err) = + self.room.try_send(CommandMessage::from(command)) + { error!( "Cannot send Command to Room {}, because {}", self.member_id, err diff --git a/src/media/errors.rs b/src/media/errors.rs deleted file mode 100644 index 700d54abd..000000000 --- a/src/media/errors.rs +++ /dev/null @@ -1,7 +0,0 @@ -use failure::Fail; - -#[derive(Fail, Debug)] -pub enum MediaError { - #[fail(display = "Unmatched state of track")] - UnmatchedTrackState, -} diff --git a/src/signalling/participants.rs b/src/signalling/participants.rs index 4973f7af2..4ef4ca223 100644 --- a/src/signalling/participants.rs +++ b/src/signalling/participants.rs @@ -3,23 +3,22 @@ //! [`RpcConnection`] authorization, establishment, message sending. use actix::{fut::wrap_future, AsyncContext, Context, SpawnHandle}; -use hashbrown::HashMap; - use futures::{ future::{self, join_all, Either}, Future, }; +use hashbrown::HashMap; +use protocol::Event; use std::time::{Duration, Instant}; use crate::{ api::{ client::rpc_connection::{ - AuthorizationError, ClosedReason, RpcConnection, + AuthorizationError, ClosedReason, EventMessage, RpcConnection, RpcConnectionClosed, }, control::{Member, MemberId}, - protocol::Event, }, log::prelude::*, signalling::{ @@ -99,7 +98,7 @@ impl ParticipantService { ) -> impl Future { match self.connections.get(&member_id) { Some(conn) => Either::A( - conn.send_event(event) + conn.send_event(EventMessage::from(event)) .map_err(move |_| RoomError::UnableToSendEvent(member_id)), ), None => Either::B(future::err(RoomError::ConnectionNotExists( diff --git a/src/signalling/room.rs b/src/signalling/room.rs index a76d12129..4b89e8d98 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -8,17 +8,17 @@ use actix::{ use failure::Fail; use futures::future; use hashbrown::HashMap; +use protocol::{Command, Event}; use std::time::Duration; use crate::{ api::{ client::rpc_connection::{ - AuthorizationError, Authorize, RpcConnectionClosed, + AuthorizationError, Authorize, CommandMessage, RpcConnectionClosed, RpcConnectionEstablished, }, control::{Member, MemberId}, - protocol::{Command, Event}, }, log::prelude::*, media::{ @@ -285,17 +285,17 @@ impl Handler for Room { } } -impl Handler for Room { +impl Handler for Room { type Result = ActFuture<(), ()>; /// Receives [`Command`] from Web client and passes it to corresponding /// handlers. Will emit [`CloseRoom`] on any error. fn handle( &mut self, - command: Command, + msg: CommandMessage, ctx: &mut Self::Context, ) -> Self::Result { - let result = match command { + let result = match msg.into() { Command::MakeSdpOffer { peer_id, sdp_offer } => { self.handle_make_sdp_offer(peer_id, sdp_offer) } @@ -418,14 +418,12 @@ mod test { }; use actix::{Addr, Arbiter, System}; + use protocol::{ + AudioSettings, Direction, Directional, MediaType, VideoSettings, + }; use super::*; - use crate::{ - api::protocol::{ - AudioSettings, Direction, Directional, MediaType, VideoSettings, - }, - media::create_peers, - }; + use crate::media::create_peers; use crate::api::client::rpc_connection::test::TestConnection; From 267126265b6f82b748160e523408a3a6fc5899ec Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 7 May 2019 15:37:07 +0300 Subject: [PATCH 163/179] Add docs --- jason/src/rpc/pinger.rs | 18 ++++++++++++++++++ jason/src/rpc/websocket.rs | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/jason/src/rpc/pinger.rs b/jason/src/rpc/pinger.rs index e290501e9..862dd71cf 100644 --- a/jason/src/rpc/pinger.rs +++ b/jason/src/rpc/pinger.rs @@ -8,17 +8,29 @@ use crate::{ utils::{window, IntervalHandle, WasmErr}, }; +/// Pinger for periodical tests connection to server by sends ping message. pub struct Pinger(Rc>); struct InnerPinger { + /// Interval for send ping message. ping_interval: i32, + + /// Count of ping message sending to server. num: u64, + + /// Count of pong message received from server. pong_at: Option, + + /// Socket to server. socket: Option>, + + /// Handler for bind closure what run when ping send. ping_task: Option, } impl InnerPinger { + /// Send ping message into socket. + /// Returns error no open socket. fn send_now(&mut self) -> Result<(), WasmErr> { match self.socket.as_ref() { None => Err(WasmErr::from_str("Unable to ping: no socket")), @@ -30,12 +42,15 @@ impl InnerPinger { } } +/// Handler for bind closure what run when ping send. struct PingTaskHandler { _ping_closure: Closure, _interval_handler: IntervalHandle, } impl Pinger { + /// Returns new instance of [`Pinger`] with given interval for ping in + /// seconds. pub fn new(ping_interval: i32) -> Self { Self(Rc::new(RefCell::new(InnerPinger { ping_interval, @@ -46,6 +61,7 @@ impl Pinger { }))) } + /// Start [`Pinger`] for give socket. pub fn start(&self, socket: Rc) -> Result<(), WasmErr> { let mut inner = self.0.borrow_mut(); inner.socket = Some(socket); @@ -71,10 +87,12 @@ impl Pinger { Ok(()) } + /// Store number of pong message. pub fn set_pong_at(&self, at: f64) { self.0.borrow_mut().pong_at = Some(at); } + /// Stop [`Pinger`]. pub fn stop(&self) { self.0.borrow_mut().ping_task.take(); } diff --git a/jason/src/rpc/websocket.rs b/jason/src/rpc/websocket.rs index 41c8ba07b..5b64fd1f8 100644 --- a/jason/src/rpc/websocket.rs +++ b/jason/src/rpc/websocket.rs @@ -11,6 +11,7 @@ use crate::{ utils::{EventListener, WasmErr}, }; +/// State of websocket. #[derive(Debug)] enum State { CONNECTING, @@ -20,6 +21,7 @@ enum State { } impl State { + /// Returns true if socket can be closed. pub fn can_close(&self) -> bool { match self { State::CONNECTING | State::OPEN => true, @@ -130,6 +132,7 @@ impl WebSocket { }) } + /// Set handler on receive message from server. pub fn on_message(&self, mut f: F) -> Result<(), WasmErr> where F: (FnMut(Result)) + 'static, @@ -148,6 +151,7 @@ impl WebSocket { Ok(()) } + /// Set handler on close socket. pub fn on_close(&self, f: F) -> Result<(), WasmErr> where F: (FnOnce(CloseMsg)) + 'static, @@ -167,6 +171,7 @@ impl WebSocket { Ok(()) } + /// Send message to server. pub fn send(&self, msg: &ClientMsg) -> Result<(), WasmErr> { let inner = self.0.borrow(); From 76c660f79ef638318c2cddfc108f2119f32a4088 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 7 May 2019 15:46:43 +0300 Subject: [PATCH 164/179] Fix docs --- src/api/client/rpc_connection.rs | 4 +- src/conf/duration.rs | 126 ------------------------------- 2 files changed, 2 insertions(+), 128 deletions(-) delete mode 100644 src/conf/duration.rs diff --git a/src/api/client/rpc_connection.rs b/src/api/client/rpc_connection.rs index b5272f7ab..57994c17e 100644 --- a/src/api/client/rpc_connection.rs +++ b/src/api/client/rpc_connection.rs @@ -7,14 +7,14 @@ use crate::api::control::MemberId; use std::fmt; -/// Wrapper [`Command`] for implements actix [`Message`]. macro_attr! { + /// Wrapper [`Command`] for implements actix [`Message`]. #[derive(Message, NewtypeFrom!)] #[rtype(result = "Result<(), ()>")] pub struct CommandMessage(Command); } -/// Wrapper [`Event`] for implements actix [`Message`]. macro_attr! { + /// Wrapper [`Event`] for implements actix [`Message`]. #[derive(Message, NewtypeFrom!)] pub struct EventMessage(Event); } diff --git a/src/conf/duration.rs b/src/conf/duration.rs deleted file mode 100644 index 1a54f40e5..000000000 --- a/src/conf/duration.rs +++ /dev/null @@ -1,126 +0,0 @@ -/// Provides deserialize [`time::Duration`] from string. -use std::fmt; -use std::time::Duration; - -use serde::de::{self, Unexpected}; -use serde::Serializer; - -struct DurationFromStringVisitor; - -pub fn deserialize<'de, D>(d: D) -> Result -where - D: de::Deserializer<'de>, -{ - Ok(d.deserialize_str(DurationFromStringVisitor)?) -} - -impl<'de> de::Visitor<'de> for DurationFromStringVisitor { - type Value = Duration; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - write!(formatter, "a string representation of duration") - } - - fn visit_str(self, value: &str) -> Result - where - E: de::Error, - { - let dur = humantime::parse_duration(value).map_err(|_| { - de::Error::invalid_value(Unexpected::Str(value), &self) - })?; - Ok(dur) - } -} - -pub fn serialize(d: &Duration, s: S) -> Result -where - S: Serializer, -{ - s.serialize_str(&format!("{}", humantime::format_duration(*d))) -} - -#[cfg(test)] -mod test { - use serde_derive::{Deserialize, Serialize}; - use serde_test::{assert_de_tokens, assert_ser_tokens, Token}; - use std::time::Duration; - - #[derive(Serialize, Deserialize, Debug, PartialEq)] - struct S { - #[serde(serialize_with = "super::serialize")] - #[serde(deserialize_with = "super::deserialize")] - dur: Duration, - } - - #[test] - fn test_de() { - let valid = vec![ - ("17nsec", Duration::new(0, 17)), - ("17nanos", Duration::new(0, 17)), - ("33ns", Duration::new(0, 33)), - ("3usec", Duration::new(0, 3000)), - ("78us", Duration::new(0, 78000)), - ("31msec", Duration::new(0, 31000000)), - ("31millis", Duration::new(0, 31000000)), - ("6ms", Duration::new(0, 6000000)), - ("3000s", Duration::new(3000, 0)), - ("300sec", Duration::new(300, 0)), - ("300secs", Duration::new(300, 0)), - ("50seconds", Duration::new(50, 0)), - ("1second", Duration::new(1, 0)), - ("100m", Duration::new(6000, 0)), - ("12min", Duration::new(720, 0)), - ("12mins", Duration::new(720, 0)), - ("1minute", Duration::new(60, 0)), - ("7minutes", Duration::new(420, 0)), - ("2h", Duration::new(7200, 0)), - ("7hr", Duration::new(25200, 0)), - ("7hrs", Duration::new(25200, 0)), - ("1hour", Duration::new(3600, 0)), - ("24hours", Duration::new(86400, 0)), - ("1day", Duration::new(86400, 0)), - ("2days", Duration::new(172800, 0)), - ("365d", Duration::new(31536000, 0)), - ("1week", Duration::new(604800, 0)), - ("7weeks", Duration::new(4233600, 0)), - ("52w", Duration::new(31449600, 0)), - ("1month", Duration::new(2630016, 0)), - ("3months", Duration::new(3 * 2630016, 0)), - ("12M", Duration::new(31560192, 0)), - ("1year", Duration::new(31557600, 0)), - ("7years", Duration::new(7 * 31557600, 0)), - ("17y", Duration::new(536479200, 0)), - ]; - - valid.into_iter().for_each(|(formatted, dur)| { - let s = S { dur }; - - assert_de_tokens( - &s, - &[ - Token::Struct { name: "S", len: 1 }, - Token::Str("dur"), - Token::Str(formatted), - Token::StructEnd, - ], - ); - }); - } - - #[test] - fn test_ser() { - let s = S { - dur: Duration::new(236179457, 45500), - }; - - assert_ser_tokens( - &s, - &[ - Token::Struct { name: "S", len: 1 }, - Token::Str("dur"), - Token::Str("7years 5months 24days 14h 36m 17s 45us 500ns"), - Token::StructEnd, - ], - ); - } -} From abf3d48e222644537ae43a8e526bb891cab33be4 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 7 May 2019 16:32:41 +0300 Subject: [PATCH 165/179] Remove api::client::protocol --- src/api/mod.rs | 1 - src/api/protocol.rs | 283 -------------------------------------------- 2 files changed, 284 deletions(-) delete mode 100644 src/api/protocol.rs diff --git a/src/api/mod.rs b/src/api/mod.rs index f12d438ca..1c66e73e5 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -2,4 +2,3 @@ pub mod client; pub mod control; -pub mod protocol; diff --git a/src/api/protocol.rs b/src/api/protocol.rs deleted file mode 100644 index 34848e063..000000000 --- a/src/api/protocol.rs +++ /dev/null @@ -1,283 +0,0 @@ -use actix::Message; -use serde::{de::Deserializer, ser::Serializer, Deserialize, Serialize}; - -// TODO: should be properly shared between medea and jason -#[cfg_attr(test, derive(PartialEq))] -#[derive(Message, Debug)] -#[allow(dead_code)] -/// Message sent by `Media Server` to `Client`. -pub enum ServerMsg { - /// `pong` message that server answers with to WebSocket client in response - /// to received `ping` message. - Pong(u64), - /// `Media Server` notifies `Client` about happened facts and it reacts on - /// them to reach the proper state. - Event(Event), -} - -#[cfg_attr(test, derive(PartialEq, Debug))] -#[allow(dead_code)] -/// Message from 'Client' to 'Media Server'. -pub enum ClientMsg { - /// `ping` message that WebSocket client is expected to send to the server - /// periodically. - Ping(u64), - /// Request of `Web Client` to change the state on `Media Server`. - Command(Command), -} - -/// WebSocket message from Web Client to Media Server. -#[derive(Deserialize, Serialize, Message)] -#[cfg_attr(test, derive(PartialEq, Debug))] -#[serde(tag = "command", content = "data")] -#[allow(dead_code)] -#[rtype(result = "Result<(), ()>")] -pub enum Command { - /// Web Client sends SDP Offer. - MakeSdpOffer { peer_id: u64, sdp_offer: String }, - /// Web Client sends SDP Answer. - MakeSdpAnswer { peer_id: u64, sdp_answer: String }, - /// Web Client sends Ice Candidate. - SetIceCandidate { peer_id: u64, candidate: String }, -} - -/// WebSocket message from Medea to Jason. -#[derive(Deserialize, Serialize, Message, Debug)] -#[cfg_attr(test, derive(PartialEq))] -#[allow(dead_code)] -#[serde(tag = "event", content = "data")] -pub enum Event { - /// Media Server notifies Web Client about necessity of RTCPeerConnection - /// creation. - PeerCreated { - peer_id: u64, - sdp_offer: Option, - tracks: Vec, - }, - /// Media Server notifies Web Client about necessity to apply specified SDP - /// Answer to Web Client's RTCPeerConnection. - SdpAnswerMade { peer_id: u64, sdp_answer: String }, - - /// Media Server notifies Web Client about necessity to apply specified - /// ICE Candidate. - IceCandidateDiscovered { peer_id: u64, candidate: String }, - - /// Media Server notifies Web Client about necessity of RTCPeerConnection - /// close. - PeersRemoved { peer_ids: Vec }, -} - -/// [`Track] with specified direction. -#[derive(Deserialize, Serialize, Debug)] -#[cfg_attr(test, derive(PartialEq))] -pub struct Directional { - pub id: u64, - pub direction: Direction, - pub media_type: MediaType, -} - -/// Direction of [`Track`]. -#[derive(Deserialize, Serialize, Debug)] -#[cfg_attr(test, derive(PartialEq))] -pub enum Direction { - Send { receivers: Vec }, - Recv { sender: u64 }, -} - -/// Type of [`Track`]. -#[derive(Deserialize, Serialize, Debug, Clone)] -#[cfg_attr(test, derive(PartialEq))] -pub enum MediaType { - Audio(AudioSettings), - Video(VideoSettings), -} - -#[derive(Deserialize, Serialize, Debug, Clone)] -#[cfg_attr(test, derive(PartialEq))] -pub struct AudioSettings {} - -#[derive(Deserialize, Serialize, Debug, Clone)] -#[cfg_attr(test, derive(PartialEq))] -pub struct VideoSettings {} - -impl Serialize for ClientMsg { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - use serde::ser::SerializeStruct; - - match self { - ClientMsg::Ping(n) => { - let mut ping = serializer.serialize_struct("ping", 1)?; - ping.serialize_field("ping", n)?; - ping.end() - } - ClientMsg::Command(command) => command.serialize(serializer), - } - } -} - -impl<'de> Deserialize<'de> for ClientMsg { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - use serde::de::Error; - - let ev = serde_json::Value::deserialize(deserializer)?; - let map = ev.as_object().ok_or_else(|| { - Error::custom(format!("unable to deser ClientMsg [{:?}]", &ev)) - })?; - - if let Some(v) = map.get("ping") { - let n = v.as_u64().ok_or_else(|| { - Error::custom(format!( - "unable to deser ClientMsg::Ping [{:?}]", - &ev - )) - })?; - - Ok(ClientMsg::Ping(n)) - } else { - let command = - serde_json::from_value::(ev).map_err(|e| { - Error::custom(format!( - "unable to deser ClientMsg::Command [{:?}]", - e - )) - })?; - Ok(ClientMsg::Command(command)) - } - } -} - -impl Serialize for ServerMsg { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - use serde::ser::SerializeStruct; - - match self { - ServerMsg::Pong(n) => { - let mut ping = serializer.serialize_struct("pong", 1)?; - ping.serialize_field("pong", n)?; - ping.end() - } - ServerMsg::Event(command) => command.serialize(serializer), - } - } -} - -impl<'de> Deserialize<'de> for ServerMsg { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - use serde::de::Error; - - let ev = serde_json::Value::deserialize(deserializer)?; - let map = ev.as_object().ok_or_else(|| { - Error::custom(format!("unable to deser ServerMsg [{:?}]", &ev)) - })?; - - if let Some(v) = map.get("pong") { - let n = v.as_u64().ok_or_else(|| { - Error::custom(format!( - "unable to deser ServerMsg::Pong [{:?}]", - &ev - )) - })?; - - Ok(ServerMsg::Pong(n)) - } else { - let event = serde_json::from_value::(ev).map_err(|e| { - Error::custom(format!( - "unable to deser ServerMsg::Event [{:?}]", - e - )) - })?; - Ok(ServerMsg::Event(event)) - } - } -} - -#[cfg(test)] -mod test { - use crate::api::protocol::{ClientMsg, Command, Event, ServerMsg}; - - #[test] - fn command() { - let command = ClientMsg::Command(Command::MakeSdpOffer { - peer_id: 77, - sdp_offer: "offer".to_owned(), - }); - #[cfg_attr(nightly, rustfmt::skip)] - let command_str = - "{\ - \"command\":\"MakeSdpOffer\",\ - \"data\":{\ - \"peer_id\":77,\ - \"sdp_offer\":\"offer\"\ - }\ - }"; - - assert_eq!(command_str, serde_json::to_string(&command).unwrap()); - assert_eq!( - command, - serde_json::from_str(&serde_json::to_string(&command).unwrap()) - .unwrap() - ); - } - - #[test] - fn ping() { - let ping = ClientMsg::Ping(15); - let ping_str = "{\"ping\":15}"; - - assert_eq!(ping_str, serde_json::to_string(&ping).unwrap()); - assert_eq!( - ping, - serde_json::from_str(&serde_json::to_string(&ping).unwrap()) - .unwrap() - ) - } - - #[test] - fn event() { - let event = ServerMsg::Event(Event::SdpAnswerMade { - peer_id: 45, - sdp_answer: "answer".to_owned(), - }); - #[cfg_attr(nightly, rustfmt::skip)] - let event_str = - "{\ - \"event\":\"SdpAnswerMade\",\ - \"data\":{\ - \"peer_id\":45,\ - \"sdp_answer\":\"answer\"\ - }\ - }"; - - assert_eq!(event_str, serde_json::to_string(&event).unwrap()); - assert_eq!( - event, - serde_json::from_str(&serde_json::to_string(&event).unwrap()) - .unwrap() - ); - } - - #[test] - fn pong() { - let pong = ServerMsg::Pong(5); - let pong_str = "{\"pong\":5}"; - - assert_eq!(pong_str, serde_json::to_string(&pong).unwrap()); - assert_eq!( - pong, - serde_json::from_str(&serde_json::to_string(&pong).unwrap()) - .unwrap() - ) - } -} From c50bd4e144bac4a97ef6aa842c9140904870442b Mon Sep 17 00:00:00 2001 From: alexlapa Date: Tue, 7 May 2019 18:38:13 +0300 Subject: [PATCH 166/179] fix lint errors --- jason/src/rpc/pinger.rs | 2 +- jason/src/rpc/websocket.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jason/src/rpc/pinger.rs b/jason/src/rpc/pinger.rs index 862dd71cf..a08c451bf 100644 --- a/jason/src/rpc/pinger.rs +++ b/jason/src/rpc/pinger.rs @@ -70,7 +70,7 @@ impl Pinger { let inner_rc = Rc::clone(&self.0); let do_ping = Closure::wrap(Box::new(move || { // its_ok if ping fails few times - inner_rc.borrow_mut().send_now().is_ok(); + let _ = inner_rc.borrow_mut().send_now(); }) as Box); let interval_id = window() diff --git a/jason/src/rpc/websocket.rs b/jason/src/rpc/websocket.rs index 5b64fd1f8..c1cb65f13 100644 --- a/jason/src/rpc/websocket.rs +++ b/jason/src/rpc/websocket.rs @@ -98,7 +98,7 @@ impl WebSocket { "close", move |_| { inner.borrow_mut().update_state(); - tx_close.send(()); + let _ = tx_close.send(()); }, )?); @@ -108,7 +108,7 @@ impl WebSocket { "open", move |_| { inner.borrow_mut().update_state(); - tx_open.send(()); + let _ = tx_open.send(()); }, )?); @@ -143,7 +143,7 @@ impl WebSocket { "message", move |msg| { let parsed = - ServerMessage::try_from(&msg).map(|msg| msg.into()); + ServerMessage::try_from(&msg).map(std::convert::Into::into); f(parsed); }, From c6dbd626d3db90b068db51f099dbd72ba5a0775b Mon Sep 17 00:00:00 2001 From: alexlapa Date: Thu, 9 May 2019 18:42:57 +0300 Subject: [PATCH 167/179] fix merge --- jason/src/api/room.rs | 8 ++++++-- src/api/client/rpc_connection.rs | 2 +- src/signalling/room.rs | 3 +-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jason/src/api/room.rs b/jason/src/api/room.rs index 074cb95b4..139756ebd 100644 --- a/jason/src/api/room.rs +++ b/jason/src/api/room.rs @@ -4,7 +4,7 @@ use futures::{ future::{Future, IntoFuture}, stream::Stream, }; -use protocol::{Directional, Event}; +use protocol::{Directional, Event, IceCandidate}; use wasm_bindgen::{prelude::*, JsValue}; use wasm_bindgen_futures::spawn_local; use web_sys::console; @@ -117,7 +117,11 @@ impl InnerRoom { } /// Applies specified ICE Candidate to specified RTCPeerConnection. - fn on_ice_candidate_discovered(&mut self, _peer_id: u64, _candidate: &str) { + fn on_ice_candidate_discovered( + &mut self, + _peer_id: u64, + _candidate: &IceCandidate, + ) { console::log_1(&JsValue::from_str( "on_ice_candidate_discovered invoked", )); diff --git a/src/api/client/rpc_connection.rs b/src/api/client/rpc_connection.rs index 91425e0dd..de65e67d6 100644 --- a/src/api/client/rpc_connection.rs +++ b/src/api/client/rpc_connection.rs @@ -94,7 +94,7 @@ pub mod test { System, }; use futures::future::Future; - use protocol::{Command, Event}; + use protocol::{Command, Event, IceCandidate}; use crate::{ api::{ diff --git a/src/signalling/room.rs b/src/signalling/room.rs index 2262d5e18..0ebb5d187 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -8,7 +8,7 @@ use actix::{ use failure::Fail; use futures::future; use hashbrown::HashMap; -use protocol::{Command, Event}; +use protocol::{Command, Event, IceCandidate}; use std::time::Duration; @@ -19,7 +19,6 @@ use crate::{ RpcConnectionEstablished, }, control::{Member, MemberId}, - protocol::{Command, Event, IceCandidate}, }, log::prelude::*, media::{ From fd4c1eee86e3108ec367e66ffb0c83bea2e31fd2 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Fri, 10 May 2019 19:48:36 +0300 Subject: [PATCH 168/179] use weak link in RoomHandle --- jason/src/api/room.rs | 80 ++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 51 deletions(-) diff --git a/jason/src/api/room.rs b/jason/src/api/room.rs index 139756ebd..ff75cc2c8 100644 --- a/jason/src/api/room.rs +++ b/jason/src/api/room.rs @@ -9,28 +9,29 @@ use wasm_bindgen::{prelude::*, JsValue}; use wasm_bindgen_futures::spawn_local; use web_sys::console; -use std::{cell::RefCell, rc::Rc}; +use std::rc::{Rc, Weak}; use crate::rpc::RPCClient; +use std::cell::RefCell; #[allow(clippy::module_name_repetitions)] #[wasm_bindgen] /// Room handle accessible from JS. -pub struct RoomHandle(Rc>>); +pub struct RoomHandle(Weak>); #[wasm_bindgen] impl RoomHandle {} /// Room handle being used by Rust external modules. -pub struct Room(Rc>>); +pub struct Room(Rc>); impl Room { pub fn new(rpc: Rc) -> Self { - Self(InnerRoom::new(rpc)) + Self(Rc::new(RefCell::new(InnerRoom::new(rpc)))) } pub fn new_handle(&self) -> RoomHandle { - RoomHandle(Rc::clone(&self.0)) + RoomHandle(Rc::downgrade(&self.0)) } /// Subscribes to provided RpcTransport messages. @@ -41,45 +42,29 @@ impl Room { .subscribe() .for_each(move |event| { // TODO: macro for convenient dispatch - match inner.borrow_mut().as_mut() { - Some(inner) => { - match event { - Event::PeerCreated { - peer_id, - sdp_offer, - tracks, - } => { - inner.on_peer_created( - peer_id, &sdp_offer, &tracks, - ); - } - Event::SdpAnswerMade { - peer_id, - sdp_answer, - } => { - inner.on_sdp_answer(peer_id, &sdp_answer); - } - Event::IceCandidateDiscovered { - peer_id, - candidate, - } => { - inner.on_ice_candidate_discovered( - peer_id, &candidate, - ); - } - Event::PeersRemoved { peer_ids } => { - inner.on_peers_removed(&peer_ids); - } - }; - Ok(()) + let mut inner = inner.borrow_mut(); + match event { + Event::PeerCreated { + peer_id, + sdp_offer, + tracks, + } => { + inner.on_peer_created(peer_id, &sdp_offer, &tracks); } - None => { - // InnerSession is gone, which means that Room was - // dropped. Not supposed to happen, since InnerSession - // should drop its tx by unsubbing from RpcClient. - Err(()) + Event::SdpAnswerMade { + peer_id, + sdp_answer, + } => { + inner.on_sdp_answer(peer_id, &sdp_answer); } - } + Event::IceCandidateDiscovered { peer_id, candidate } => { + inner.on_ice_candidate_discovered(peer_id, &candidate); + } + Event::PeersRemoved { peer_ids } => { + inner.on_peers_removed(&peer_ids); + } + }; + Ok(()) }) .into_future() .then(|_| Ok(())); @@ -97,8 +82,8 @@ struct InnerRoom { } impl InnerRoom { - fn new(rpc: Rc) -> Rc>> { - Rc::new(RefCell::new(Some(Self { rpc }))) + fn new(rpc: Rc) -> Self { + Self { rpc } } /// Creates RTCPeerConnection with provided ID. @@ -133,13 +118,6 @@ impl InnerRoom { } } -impl Drop for Room { - fn drop(&mut self) { - // Drop InnerRoom, invalidates all spawned RoomHandler's. - self.0.borrow_mut().take(); - } -} - impl Drop for InnerRoom { fn drop(&mut self) { // Drops event handling task. From 29c89e433b9782b808cb284f6acd388389521dc1 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Sun, 12 May 2019 20:23:00 +0300 Subject: [PATCH 169/179] refactor, extend docs --- jason/src/api/jason.rs | 13 +++++++--- jason/src/api/mod.rs | 2 +- jason/src/api/room.rs | 22 ++++++++-------- jason/src/rpc/mod.rs | 8 ++++-- jason/src/rpc/pinger.rs | 8 +++--- jason/src/rpc/websocket.rs | 4 ++- jason/src/utils/errors.rs | 1 + jason/src/utils/event_listener.rs | 4 +++ jason/src/utils/mod.rs | 42 ++++--------------------------- jason/tests/web.rs | 1 - 10 files changed, 46 insertions(+), 59 deletions(-) diff --git a/jason/src/api/jason.rs b/jason/src/api/jason.rs index b7de0b3e9..17aa66614 100644 --- a/jason/src/api/jason.rs +++ b/jason/src/api/jason.rs @@ -20,6 +20,8 @@ pub struct Inner { rooms: Vec, } +/// Main application handler. Responsible for managing shared transports, +/// local media, room initialization. #[wasm_bindgen] impl Jason { #[wasm_bindgen(constructor)] @@ -28,8 +30,9 @@ impl Jason { Self::default() } - /// Enter room with provided token, return initialized connection handler. - /// Effectively returns Result + /// Enter room with provided token. Will establish connection with Medea + /// server (if it doesn't already exist). Fails if unable to connect to + /// Medea. Effectively returns Result pub fn join_room(&self, token: String) -> Promise { let mut rpc = RPCClient::new(token, 3000); @@ -38,8 +41,7 @@ impl Jason { .init() .and_then(move |()| { let rpc = Rc::new(rpc); - let room = Room::new(Rc::clone(&rpc)); - room.subscribe(&rpc); + let room = Room::new(&rpc); let handle = room.new_handle(); @@ -53,5 +55,8 @@ impl Jason { future_to_promise(fut) } + /// Drops Jason and all related objects (Rooms, Connections, Streams etc. ). + /// All objects related to this Jason instance will be detached (you will + /// still hold them, but unable to use). pub fn dispose(self) {} } diff --git a/jason/src/api/mod.rs b/jason/src/api/mod.rs index 71de134e0..c709898ed 100644 --- a/jason/src/api/mod.rs +++ b/jason/src/api/mod.rs @@ -1,4 +1,4 @@ -//! External Jason API. +//! External Jason API accessible from JS. mod jason; mod room; diff --git a/jason/src/api/room.rs b/jason/src/api/room.rs index ff75cc2c8..1b049fe93 100644 --- a/jason/src/api/room.rs +++ b/jason/src/api/room.rs @@ -26,17 +26,11 @@ impl RoomHandle {} pub struct Room(Rc>); impl Room { - pub fn new(rpc: Rc) -> Self { - Self(Rc::new(RefCell::new(InnerRoom::new(rpc)))) - } - - pub fn new_handle(&self) -> RoomHandle { - RoomHandle(Rc::downgrade(&self.0)) - } + /// Creates new [`Room`] associating it with provided [`RpcClient`]. + pub fn new(rpc: &Rc) -> Self { + let room = Rc::new(RefCell::new(InnerRoom::new(Rc::clone(&rpc)))); - /// Subscribes to provided RpcTransport messages. - pub fn subscribe(&self, rpc: &RPCClient) { - let inner = Rc::clone(&self.0); + let inner = Rc::clone(&room); let process_msg_task = rpc .subscribe() @@ -72,6 +66,14 @@ impl Room { // Spawns Promise in JS, does not provide any handles, so current way to // stop this stream is to drop all connected Senders. spawn_local(process_msg_task); + + Self(room) + } + + /// Creates new [`RoomHandle`] used by JS side. You can create them as many + /// as you need. + pub fn new_handle(&self) -> RoomHandle { + RoomHandle(Rc::downgrade(&self.0)) } } diff --git a/jason/src/rpc/mod.rs b/jason/src/rpc/mod.rs index 99ad65fb6..519aedea1 100644 --- a/jason/src/rpc/mod.rs +++ b/jason/src/rpc/mod.rs @@ -36,11 +36,12 @@ struct Inner { /// WebSocket connection to remote media server. sock: Option>, - /// Credentials for authorize on remote media server. + /// Credentials used to authorize connection. token: String, - /// Sends ping message to remote media server with specified interval. pinger: Pinger, + + /// Event's subscribers list. subs: Vec>, } @@ -127,6 +128,7 @@ impl RPCClient { ) } + /// Returns Stream of all Events received by this [`RpcClient`]. // TODO: proper sub registry pub fn subscribe(&self) -> impl Stream { let (tx, rx) = unbounded(); @@ -135,11 +137,13 @@ impl RPCClient { rx } + /// Unsubscribe from this [`RpcClient`]. Drops all subscriptions atm. // TODO: proper sub registry pub fn unsub(&self) { self.0.borrow_mut().subs.clear(); } + /// Sends Command to Medea. // TODO: proper sub registry pub fn _send_command(&self, command: Command) { let socket_borrow = &self.0.borrow().sock; diff --git a/jason/src/rpc/pinger.rs b/jason/src/rpc/pinger.rs index a08c451bf..cbcac1cde 100644 --- a/jason/src/rpc/pinger.rs +++ b/jason/src/rpc/pinger.rs @@ -8,7 +8,8 @@ use crate::{ utils::{window, IntervalHandle, WasmErr}, }; -/// Pinger for periodical tests connection to server by sends ping message. +/// Responsible for sending/handling keep-alive requests, detecting connection +/// loss. pub struct Pinger(Rc>); struct InnerPinger { @@ -61,7 +62,8 @@ impl Pinger { }))) } - /// Start [`Pinger`] for give socket. + /// Start [`Pinger`] for given [`WebSocket`]. Sends first ping immediately, + /// so will fail if provided [`WebSocket`] is not active. pub fn start(&self, socket: Rc) -> Result<(), WasmErr> { let mut inner = self.0.borrow_mut(); inner.socket = Some(socket); @@ -87,7 +89,7 @@ impl Pinger { Ok(()) } - /// Store number of pong message. + /// Timestamp of last pong received. pub fn set_pong_at(&self, at: f64) { self.0.borrow_mut().pong_at = Some(at); } diff --git a/jason/src/rpc/websocket.rs b/jason/src/rpc/websocket.rs index c1cb65f13..a51c77656 100644 --- a/jason/src/rpc/websocket.rs +++ b/jason/src/rpc/websocket.rs @@ -69,6 +69,7 @@ impl InnerSocket { }) } + /// Checks underlying WebSocket state and updates socket_state. fn update_state(&mut self) { match State::try_from(self.socket.ready_state()) { Ok(new_state) => self.socket_state = new_state, @@ -81,7 +82,8 @@ impl InnerSocket { } impl WebSocket { - /// Resolves only if connection succeeded. + /// Initiates new WebSocket connection. Resolves only when underlying + /// connection becomes active. pub fn new(url: &str) -> impl Future { let (tx_close, rx_close) = futures::oneshot(); let (tx_open, rx_open) = futures::oneshot(); diff --git a/jason/src/utils/errors.rs b/jason/src/utils/errors.rs index 596069528..06170fd29 100644 --- a/jason/src/utils/errors.rs +++ b/jason/src/utils/errors.rs @@ -7,6 +7,7 @@ use std::{ fmt::{Display, Formatter}, }; +/// Generic application error. #[derive(Debug)] pub enum WasmErr { JsError(JsValue), diff --git a/jason/src/utils/event_listener.rs b/jason/src/utils/event_listener.rs index 49352c19b..718dce7b0 100644 --- a/jason/src/utils/event_listener.rs +++ b/jason/src/utils/event_listener.rs @@ -6,6 +6,10 @@ use web_sys::EventTarget; use crate::utils::WasmErr; +/// Wrapper for closure that handles some +/// [`EventTarget`](https://developer.mozilla.org/ru/docs/Web/API/EventTarget) +/// event. Implement drop that drops provided closure and unregisters +/// event handler. pub struct EventListener< T: Deref, A: FromWasmAbi + 'static, diff --git a/jason/src/utils/mod.rs b/jason/src/utils/mod.rs index b43d61771..10fb38bf5 100644 --- a/jason/src/utils/mod.rs +++ b/jason/src/utils/mod.rs @@ -6,51 +6,19 @@ use web_sys::Window; pub use self::errors::WasmErr; pub use self::event_listener::EventListener; -pub struct IntervalHandle(pub i32); - +/// Returns [`window`] object. Panics if unable to access it. pub fn window() -> Window { // cannot use lazy_static since window is !Sync // safe to unwrap web_sys::window().unwrap() } +/// Wrapper around interval timer id. Implements Drop that clears interval with +/// provided id. +pub struct IntervalHandle(pub i32); + impl Drop for IntervalHandle { fn drop(&mut self) { window().clear_interval_with_handle(self.0); } } - -// pub fn bind_handler_fn_mut( -// event: &str, -// target: &EventTarget, -// f: F, -//) -> Result R>, JsValue> -// where -// F: (FnMut(A) -> R) + 'static, -// A: FromWasmAbi + 'static, -// R: ReturnWasmAbi + 'static, -//{ -// let closure = Closure::wrap(Box::new(f) as Box R>); -// target.add_event_listener_with_callback( -// event, -// closure.as_ref().unchecked_ref(), -// )?; -// Ok(closure) -//} -// pub fn bind_handler_fn_once( -// event: &str, -// target: &EventTarget, -// f: F, -//) -> Result R>, JsValue> -// where -// F: (FnOnce(A) -> R) + 'static, -// A: FromWasmAbi + 'static, -// R: ReturnWasmAbi + 'static, -//{ -// let closure: Closure (R)> = Closure::once(f); -// target.add_event_listener_with_callback( -// event, -// closure.as_ref().unchecked_ref(), -// )?; -// Ok(closure) -//} diff --git a/jason/tests/web.rs b/jason/tests/web.rs index 250ddd906..72a5ce6ca 100644 --- a/jason/tests/web.rs +++ b/jason/tests/web.rs @@ -1,6 +1,5 @@ #![cfg(target_arch = "wasm32")] -use jason::Jason; use wasm_bindgen_test::*; wasm_bindgen_test_configure!(run_in_browser); From 0f51c6d252436fba70e064d043d5598c8341ce39 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Sun, 12 May 2019 20:27:54 +0300 Subject: [PATCH 170/179] refactor --- jason/src/api/room.rs | 4 ++-- protocol/src/lib.rs | 4 ++-- src/media/mod.rs | 2 +- src/media/peer.rs | 22 +++++++++++----------- src/media/track.rs | 4 ++-- src/signalling/room.rs | 10 +++++----- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/jason/src/api/room.rs b/jason/src/api/room.rs index 1b049fe93..3e1611290 100644 --- a/jason/src/api/room.rs +++ b/jason/src/api/room.rs @@ -4,7 +4,7 @@ use futures::{ future::{Future, IntoFuture}, stream::Stream, }; -use protocol::{Directional, Event, IceCandidate}; +use protocol::{Track, Event, IceCandidate}; use wasm_bindgen::{prelude::*, JsValue}; use wasm_bindgen_futures::spawn_local; use web_sys::console; @@ -93,7 +93,7 @@ impl InnerRoom { &mut self, _peer_id: u64, _sdp_offer: &Option, - _tracks: &[Directional], + _tracks: &[Track], ) { console::log_1(&JsValue::from_str("on_peer_created invoked")); } diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index ef9fd3bf1..e0c4621fb 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -52,7 +52,7 @@ pub enum Event { PeerCreated { peer_id: u64, sdp_offer: Option, - tracks: Vec, + tracks: Vec, }, /// Media Server notifies Web Client about necessity to apply specified SDP /// Answer to Web Client's RTCPeerConnection. @@ -81,7 +81,7 @@ pub struct IceCandidate { /// [`Track] with specified direction. #[derive(Deserialize, Serialize)] #[cfg_attr(test, derive(PartialEq, Debug))] -pub struct Directional { +pub struct Track { pub id: u64, pub direction: Direction, pub media_type: MediaType, diff --git a/src/media/mod.rs b/src/media/mod.rs index ed48bf622..3d7e8a4df 100644 --- a/src/media/mod.rs +++ b/src/media/mod.rs @@ -7,5 +7,5 @@ pub use self::{ create_peers, Id as PeerId, New, Peer, PeerStateError, PeerStateMachine, WaitLocalHaveRemote, WaitLocalSdp, WaitRemoteSdp, }, - track::{Id as TrackId, Track}, + track::{Id as TrackId, MediaTrack}, }; diff --git a/src/media/peer.rs b/src/media/peer.rs index 3bb7f0191..eca076538 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -6,14 +6,14 @@ use failure::Fail; use hashbrown::HashMap; use protocol::{ - AudioSettings, Direction, Directional, MediaType, VideoSettings, + AudioSettings, Direction, Track, MediaType, VideoSettings, }; use std::{convert::TryFrom, fmt::Display, sync::Arc}; use crate::{ api::control::MemberId, - media::{Track, TrackId}, + media::{MediaTrack, TrackId}, }; /// Newly initialized [`Peer`] ready to signalling. @@ -192,8 +192,8 @@ pub struct Context { partner_member: MemberId, sdp_offer: Option, sdp_answer: Option, - receivers: HashMap>, - senders: HashMap>, + receivers: HashMap>, + senders: HashMap>, } /// [`RTCPeerConnection`] representation. @@ -225,11 +225,11 @@ impl Peer { } /// Returns [`Track`]'s of [`Peer`]. - pub fn tracks(&self) -> Vec { + pub fn tracks(&self) -> Vec { let tracks = self.context.senders.iter().fold( vec![], |mut tracks, (_, track)| { - tracks.push(Directional { + tracks.push(Track { id: track.id, media_type: track.media_type.clone(), direction: Direction::Send { @@ -243,7 +243,7 @@ impl Peer { .receivers .iter() .fold(tracks, |mut tracks, (_, track)| { - tracks.push(Directional { + tracks.push(Track { id: track.id, media_type: track.media_type.clone(), direction: Direction::Recv { @@ -305,12 +305,12 @@ impl Peer { } /// Add [`Track`] to [`Peer`] for send. - pub fn add_sender(&mut self, track: Arc) { + pub fn add_sender(&mut self, track: Arc) { self.context.senders.insert(track.id, track); } /// Add [`Track`] to [`Peer`] for receive. - pub fn add_receiver(&mut self, track: Arc) { + pub fn add_receiver(&mut self, track: Arc) { self.context.receivers.insert(track.id, track); } } @@ -364,9 +364,9 @@ pub fn create_peers( Peer::new(responder_peer_id, responder, caller_peer_id, caller_peer_id); let track_audio = - Arc::new(Track::new(1, MediaType::Audio(AudioSettings {}))); + Arc::new(MediaTrack::new(1, MediaType::Audio(AudioSettings {}))); let track_video = - Arc::new(Track::new(2, MediaType::Video(VideoSettings {}))); + Arc::new(MediaTrack::new(2, MediaType::Video(VideoSettings {}))); caller_peer.add_sender(track_audio.clone()); caller_peer.add_sender(track_video.clone()); responder_peer.add_receiver(track_audio); diff --git a/src/media/track.rs b/src/media/track.rs index 5604423ff..ad0eb6c76 100644 --- a/src/media/track.rs +++ b/src/media/track.rs @@ -9,12 +9,12 @@ pub type Id = u64; /// [`MediaStreamTrack`] representation. #[derive(Debug)] -pub struct Track { +pub struct MediaTrack { pub id: Id, pub media_type: MediaType, } -impl Track { +impl MediaTrack { /// Creates new [`Track`] of the specified type. pub fn new(id: Id, media_type: MediaType) -> Self { Self { id, media_type } diff --git a/src/signalling/room.rs b/src/signalling/room.rs index 0ebb5d187..d93a09d45 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -416,7 +416,7 @@ mod test { use actix::{Addr, Arbiter, System}; use protocol::{ - AudioSettings, Direction, Directional, MediaType, VideoSettings, + AudioSettings, Direction, Track, MediaType, VideoSettings, }; use super::*; @@ -469,12 +469,12 @@ mod test { peer_id: 1, sdp_offer: None, tracks: vec![ - Directional { + Track { id: 1, direction: Direction::Send { receivers: vec![2] }, media_type: MediaType::Audio(AudioSettings {}), }, - Directional { + Track { id: 2, direction: Direction::Send { receivers: vec![2] }, media_type: MediaType::Video(VideoSettings {}), @@ -506,12 +506,12 @@ mod test { peer_id: 2, sdp_offer: Some("caller_offer".into()), tracks: vec![ - Directional { + Track { id: 1, direction: Direction::Recv { sender: 1 }, media_type: MediaType::Audio(AudioSettings {}), }, - Directional { + Track { id: 2, direction: Direction::Recv { sender: 1 }, media_type: MediaType::Video(VideoSettings {}), From dfa246787a800aef7d9bcf4287243fe2c9b3edc7 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Mon, 13 May 2019 14:02:50 +0300 Subject: [PATCH 171/179] refactor --- jason/src/api/room.rs | 2 +- jason/src/rpc/mod.rs | 77 ++++++++++++++++++++---------------------- src/media/peer.rs | 4 +-- src/media/track.rs | 1 + src/signalling/room.rs | 4 +-- 5 files changed, 41 insertions(+), 47 deletions(-) diff --git a/jason/src/api/room.rs b/jason/src/api/room.rs index 3e1611290..973fa51bb 100644 --- a/jason/src/api/room.rs +++ b/jason/src/api/room.rs @@ -4,7 +4,7 @@ use futures::{ future::{Future, IntoFuture}, stream::Stream, }; -use protocol::{Track, Event, IceCandidate}; +use protocol::{Event, IceCandidate, Track}; use wasm_bindgen::{prelude::*, JsValue}; use wasm_bindgen_futures::spawn_local; use web_sys::console; diff --git a/jason/src/rpc/mod.rs b/jason/src/rpc/mod.rs index 519aedea1..334ca57de 100644 --- a/jason/src/rpc/mod.rs +++ b/jason/src/rpc/mod.rs @@ -56,49 +56,43 @@ impl Inner { } } -/// Returns handler for bind on close WebSocket connection. -fn on_close(inner_rc: Rc>) -> Box { - Box::new(move |msg: CloseMsg| { - let mut inner = inner_rc.borrow_mut(); - inner.sock.take(); - inner.pinger.stop(); - - // TODO: reconnect on disconnect, propagate error if unable - // to reconnect - match msg { - CloseMsg::Normal(_msg) | CloseMsg::Disconnect(_msg) => {} - } - }) +/// Handles close messsage from remote server. +fn on_close(inner_rc: &Rc>, close_msg: CloseMsg) { + let mut inner = inner_rc.borrow_mut(); + inner.sock.take(); + inner.pinger.stop(); + + // TODO: reconnect on disconnect, propagate error if unable + // to reconnect + match close_msg { + CloseMsg::Normal(_msg) | CloseMsg::Disconnect(_msg) => {} + } } -/// Returns handler for bind on receive server message. -fn on_message( - inner_rc: Rc>, -) -> Box)> { - Box::new(move |msg: Result| { - let inner = inner_rc.borrow(); - match msg { - Ok(ServerMsg::Pong(_num)) => { - // TODO: detect no pings - inner.pinger.set_pong_at(Date::now()); - } - Ok(ServerMsg::Event(event)) => { - // TODO: many subs, filter messages by session - if let Some(sub) = inner.subs.iter().next() { - if let Err(err) = sub.unbounded_send(event) { - // TODO: receiver is gone, should delete - // this subs tx - WasmErr::from(err).log_err(); - } +/// Handles messages from remote server. +fn on_message(inner_rc: &Rc>, msg: Result) { + let inner = inner_rc.borrow(); + match msg { + Ok(ServerMsg::Pong(_num)) => { + // TODO: detect no pings + inner.pinger.set_pong_at(Date::now()); + } + Ok(ServerMsg::Event(event)) => { + // TODO: many subs, filter messages by session + if let Some(sub) = inner.subs.iter().next() { + if let Err(err) = sub.unbounded_send(event) { + // TODO: receiver is gone, should delete + // this subs tx + WasmErr::from(err).log_err(); } } - Err(err) => { - // TODO: protocol versions mismatch? should drop - // connection if so - err.log_err(); - } } - }) + Err(err) => { + // TODO: protocol versions mismatch? should drop + // connection if so + err.log_err(); + } + } } impl RPCClient { @@ -117,10 +111,13 @@ impl RPCClient { inner.borrow_mut().pinger.start(Rc::clone(&socket))?; let inner_rc = Rc::clone(&inner); - socket.on_message(on_message(inner_rc))?; + socket.on_message(move |msg: Result| { + on_message(&inner_rc, msg) + })?; let inner_rc = Rc::clone(&inner); - socket.on_close(on_close(inner_rc))?; + socket + .on_close(move |msg: CloseMsg| on_close(&inner_rc, msg))?; inner.borrow_mut().sock.replace(socket); Ok(()) diff --git a/src/media/peer.rs b/src/media/peer.rs index eca076538..9b76293b2 100644 --- a/src/media/peer.rs +++ b/src/media/peer.rs @@ -5,9 +5,7 @@ #![allow(clippy::use_self)] use failure::Fail; use hashbrown::HashMap; -use protocol::{ - AudioSettings, Direction, Track, MediaType, VideoSettings, -}; +use protocol::{AudioSettings, Direction, MediaType, Track, VideoSettings}; use std::{convert::TryFrom, fmt::Display, sync::Arc}; diff --git a/src/media/track.rs b/src/media/track.rs index ad0eb6c76..8b5795cb5 100644 --- a/src/media/track.rs +++ b/src/media/track.rs @@ -9,6 +9,7 @@ pub type Id = u64; /// [`MediaStreamTrack`] representation. #[derive(Debug)] +#[allow(clippy::module_name_repetitions)] pub struct MediaTrack { pub id: Id, pub media_type: MediaType, diff --git a/src/signalling/room.rs b/src/signalling/room.rs index d93a09d45..dfec9b5c6 100644 --- a/src/signalling/room.rs +++ b/src/signalling/room.rs @@ -415,9 +415,7 @@ mod test { use std::sync::{atomic::AtomicUsize, Arc, Mutex}; use actix::{Addr, Arbiter, System}; - use protocol::{ - AudioSettings, Direction, Track, MediaType, VideoSettings, - }; + use protocol::{AudioSettings, Direction, MediaType, Track, VideoSettings}; use super::*; use crate::media::create_peers; From ff29c0039120842e90ba334fb3a26286d7748b25 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 14 May 2019 13:49:09 +0300 Subject: [PATCH 172/179] Add features for protocol package --- Cargo.toml | 2 +- jason/Cargo.toml | 2 +- protocol/Cargo.toml | 5 +++++ protocol/src/lib.rs | 34 ++++++++++++++++++++++++---------- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 376a806fa..12b7382c0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ hashbrown = "0.1" humantime = "1.2" macro-attr = "0.2" newtype_derive = "0.1" -protocol = { path = "protocol" } +protocol = { path = "protocol", features = ['medea'] } serde = { version = "1.0", features = ['derive'] } serde_json = "1.0" slog = "2.4" diff --git a/jason/Cargo.toml b/jason/Cargo.toml index 849004750..9e185ff78 100644 --- a/jason/Cargo.toml +++ b/jason/Cargo.toml @@ -23,7 +23,7 @@ futures = "0.1" js-sys = "0.3" macro-attr = "0.2" newtype_derive = "0.1" -protocol = { path = "../protocol" } +protocol = { path = "../protocol", features = ['jason'] } serde = { version = "1.0", features = ['derive'] } serde_json = "1.0" wasm-bindgen = { version = "0.2", features = ['serde-serialize'] } diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index f0833f5b8..7fdf1c700 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -7,6 +7,11 @@ homepage = "https://github.com/instrumentisto/medea" readme = "README.md" repository = "https://github.com/instrumentisto/medea" +[features] +default = ["jason", "medea"] +jason = [] +medea = [] + [dependencies] serde = { version = "1.0", features = ['derive'] } serde_json = "1.0" diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index e0c4621fb..a350a0b4a 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -25,9 +25,10 @@ pub enum ClientMsg { } /// WebSocket message from Web Client to Media Server. -#[derive(Deserialize, Serialize)] -#[serde(tag = "command", content = "data")] #[cfg_attr(test, derive(PartialEq, Debug))] +#[cfg_attr(feature = "medea", derive(Deserialize))] +#[cfg_attr(feature = "jason", derive(Serialize))] +#[serde(tag = "command", content = "data")] #[allow(dead_code)] pub enum Command { /// Web Client sends SDP Offer. @@ -42,9 +43,10 @@ pub enum Command { } /// WebSocket message from Medea to Jason. -#[derive(Deserialize, Serialize)] -#[serde(tag = "event", content = "data")] +#[cfg_attr(feature = "medea", derive(Serialize))] +#[cfg_attr(feature = "jason", derive(Deserialize))] #[cfg_attr(test, derive(PartialEq, Debug))] +#[serde(tag = "event", content = "data")] #[allow(dead_code)] pub enum Event { /// Media Server notifies Web Client about necessity of RTCPeerConnection @@ -71,7 +73,7 @@ pub enum Event { } /// Represents [`RtcIceCandidateInit`] object. -#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] pub struct IceCandidate { pub candidate: String, pub sdp_m_line_index: Option, @@ -79,7 +81,8 @@ pub struct IceCandidate { } /// [`Track] with specified direction. -#[derive(Deserialize, Serialize)] +#[cfg_attr(feature = "medea", derive(Serialize))] +#[cfg_attr(feature = "jason", derive(Deserialize))] #[cfg_attr(test, derive(PartialEq, Debug))] pub struct Track { pub id: u64, @@ -88,7 +91,8 @@ pub struct Track { } /// Direction of [`Track`]. -#[derive(Deserialize, Serialize)] +#[cfg_attr(feature = "medea", derive(Serialize))] +#[cfg_attr(feature = "jason", derive(Deserialize))] #[cfg_attr(test, derive(PartialEq, Debug))] pub enum Direction { Send { receivers: Vec }, @@ -96,21 +100,28 @@ pub enum Direction { } /// Type of [`Track`]. -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "medea", derive(Serialize))] +#[cfg_attr(feature = "jason", derive(Deserialize))] #[cfg_attr(test, derive(PartialEq))] pub enum MediaType { Audio(AudioSettings), Video(VideoSettings), } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "medea", derive(Serialize))] +#[cfg_attr(feature = "jason", derive(Deserialize))] #[cfg_attr(test, derive(PartialEq))] pub struct AudioSettings {} -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug)] +#[cfg_attr(feature = "medea", derive(Serialize))] +#[cfg_attr(feature = "jason", derive(Deserialize))] #[cfg_attr(test, derive(PartialEq))] pub struct VideoSettings {} +#[cfg(feature = "jason")] impl Serialize for ClientMsg { fn serialize(&self, serializer: S) -> Result where @@ -129,6 +140,7 @@ impl Serialize for ClientMsg { } } +#[cfg(feature = "medea")] impl<'de> Deserialize<'de> for ClientMsg { fn deserialize(deserializer: D) -> Result where @@ -163,6 +175,7 @@ impl<'de> Deserialize<'de> for ClientMsg { } } +#[cfg(feature = "medea")] impl Serialize for ServerMsg { fn serialize(&self, serializer: S) -> Result where @@ -181,6 +194,7 @@ impl Serialize for ServerMsg { } } +#[cfg(feature = "jason")] impl<'de> Deserialize<'de> for ServerMsg { fn deserialize(deserializer: D) -> Result where From 2c494de4dccdafa4813f329d8d5c01c93c817339 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Thu, 16 May 2019 15:00:14 +0300 Subject: [PATCH 173/179] Add webpack config for production - add build script to Makefile --- Makefile | 33 ++++++++++++++++++- jason/Cargo.toml | 1 + jason/e2e-demo/package.json | 4 +-- .../{webpack.config.js => webpack.dev.js} | 8 ++--- jason/e2e-demo/webpack.prod.js | 24 ++++++++++++++ 5 files changed, 63 insertions(+), 7 deletions(-) rename jason/e2e-demo/{webpack.config.js => webpack.dev.js} (76%) create mode 100644 jason/e2e-demo/webpack.prod.js diff --git a/Makefile b/Makefile index b43ba3f80..5c6512d1a 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,8 @@ eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\ # Aliases # ########### +build: build.jason + # Resolve all project dependencies. # # Usage: @@ -46,6 +48,33 @@ test: test.unit +################## +# Build commands # +################## + +# Build Jason E2E demo in production mode. +# +# Usage: +# make build.jason + +build.jason: + npm run build --prefix=jason/e2e-demo + @make opt.jason + + +# Optimize wasm binary. +# +# Usage: +# make opt.wasm [filename=(|)] + +wasm-file = $(if $(call eq,$(filename),),$(shell find jason/e2e-demo/dist -name '*.module.wasm'),$(filename)) + +opt.jason: + wasm-opt $(wasm-file) -o $(wasm-file) + + + + ################## # Cargo commands # ################## @@ -172,8 +201,10 @@ up.medea: # .PHONY section # ################## -.PHONY: cargo cargo.fmt cargo.lint \ +.PHONY: build build.jason \ + cargo cargo.fmt cargo.lint \ docs docs.rust \ + opt.jason \ test test.unit \ up up.jason up.medea \ yarn diff --git a/jason/Cargo.toml b/jason/Cargo.toml index 9e185ff78..c2b99a948 100644 --- a/jason/Cargo.toml +++ b/jason/Cargo.toml @@ -12,6 +12,7 @@ repository = "https://github.com/instrumentisto/medea" crate-type = ["cdylib", "rlib"] [profile.release] +lto = true opt-level = "s" # Tell `rustc` to optimize for small code size. [features] diff --git a/jason/e2e-demo/package.json b/jason/e2e-demo/package.json index 162053284..61e639f47 100644 --- a/jason/e2e-demo/package.json +++ b/jason/e2e-demo/package.json @@ -2,8 +2,8 @@ "name": "jason-e2e-demo", "private": true, "scripts": { - "start": "webpack-dev-server -d --open --port 8081", - "build": "webpack" + "start": "webpack-dev-server -d --config webpack.dev.js --open --port 8081", + "build": "webpack --config webpack.prod.js" }, "devDependencies": { "@wasm-tool/wasm-pack-plugin": "^0.2", diff --git a/jason/e2e-demo/webpack.config.js b/jason/e2e-demo/webpack.dev.js similarity index 76% rename from jason/e2e-demo/webpack.config.js rename to jason/e2e-demo/webpack.dev.js index e1fba5db1..dedf248c3 100644 --- a/jason/e2e-demo/webpack.config.js +++ b/jason/e2e-demo/webpack.dev.js @@ -6,13 +6,14 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); const dist = path.resolve(__dirname, "dist"); module.exports = { + mode: 'development', entry: "./js/index.js", output: { path: dist, filename: "bundle.js" }, devServer: { - contentBase: dist, + contentBase: dist }, plugins: [ new HtmlWebpackPlugin({ @@ -20,8 +21,7 @@ module.exports = { }), new WasmPackPlugin({ crateDirectory: path.resolve(__dirname, '../'), - // WasmPackPlugin defaults to compiling in "dev" profile. - // To change that, use `forceMode: 'release'`. - }), + forceMode: 'development' + }) ] }; diff --git a/jason/e2e-demo/webpack.prod.js b/jason/e2e-demo/webpack.prod.js new file mode 100644 index 000000000..5032eb0d8 --- /dev/null +++ b/jason/e2e-demo/webpack.prod.js @@ -0,0 +1,24 @@ +const path = require("path"); + +const WasmPackPlugin = require("@wasm-tool/wasm-pack-plugin"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); + +const dist = path.resolve(__dirname, "dist"); + +module.exports = { + mode: 'production', + entry: "./js/index.js", + output: { + path: dist, + filename: "bundle.js" + }, + plugins: [ + new HtmlWebpackPlugin({ + template: 'index.html' + }), + new WasmPackPlugin({ + crateDirectory: path.resolve(__dirname, '../'), + forceMode: 'production' + }) + ] +}; From a19202bb0880b1907dd34c2b697d014a1b672166 Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 21 May 2019 15:01:14 +0300 Subject: [PATCH 174/179] Remove impl TryFrom for ServerMsg --- Cargo.lock | 3 +-- Cargo.toml | 5 +++-- Makefile | 9 +++++---- jason/Cargo.toml | 7 +------ jason/src/lib.rs | 38 ++++++++++++++++++++------------------ jason/src/rpc/websocket.rs | 25 ++----------------------- 6 files changed, 32 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ca5572dc..88ef218c5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -722,11 +722,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "jason" version = "0.1.0-dev" dependencies = [ + "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", - "macro-attr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "newtype_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "protocol 0.1.0", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 12b7382c0..07ee3e4d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,9 @@ members = [ "protocol", ] -[profile.release] -lto = "thin" +#[profile.release] +#lto = true +#opt-level = "z" # Tell `rustc` to optimize for small code size. [dependencies] actix = "0.7" diff --git a/Makefile b/Makefile index 5c6512d1a..ddf6e343a 100644 --- a/Makefile +++ b/Makefile @@ -58,6 +58,7 @@ test: test.unit # make build.jason build.jason: + @rm -rf jason/e2e-demo/dist/ npm run build --prefix=jason/e2e-demo @make opt.jason @@ -65,12 +66,12 @@ build.jason: # Optimize wasm binary. # # Usage: -# make opt.wasm [filename=(|)] +# make opt.wasm [file=(|)] -wasm-file = $(if $(call eq,$(filename),),$(shell find jason/e2e-demo/dist -name '*.module.wasm'),$(filename)) +wasm-file = $(if $(call eq,$(file),),$(shell find jason/e2e-demo/dist -name '*.module.wasm'),$(file)) opt.jason: - wasm-opt $(wasm-file) -o $(wasm-file) + wasm-opt $(wasm-file) -Os -d -o $(wasm-file) @@ -207,5 +208,5 @@ up.medea: opt.jason \ test test.unit \ up up.jason up.medea \ - yarn + yarn wasm2wat diff --git a/jason/Cargo.toml b/jason/Cargo.toml index c2b99a948..ce7a28baa 100644 --- a/jason/Cargo.toml +++ b/jason/Cargo.toml @@ -11,19 +11,14 @@ repository = "https://github.com/instrumentisto/medea" [lib] crate-type = ["cdylib", "rlib"] -[profile.release] -lto = true -opt-level = "s" # Tell `rustc` to optimize for small code size. - [features] default = ["console_error_panic_hook", "wee_alloc"] [dependencies] +cfg-if = "0.1" console_error_panic_hook = { version = "0.1", optional = true } futures = "0.1" js-sys = "0.3" -macro-attr = "0.2" -newtype_derive = "0.1" protocol = { path = "../protocol", features = ['jason'] } serde = { version = "1.0", features = ['derive'] } serde_json = "1.0" diff --git a/jason/src/lib.rs b/jason/src/lib.rs index b813b3719..6bcd500b5 100644 --- a/jason/src/lib.rs +++ b/jason/src/lib.rs @@ -1,26 +1,28 @@ -#[macro_use] -extern crate macro_attr; -#[macro_use] -extern crate newtype_derive; +use cfg_if::cfg_if; mod api; mod rpc; mod utils; -// When the `console_error_panic_hook` feature is enabled, we can call the -// `set_panic_hook` function at least once during initialization, and then -// we will get better error messages if our code ever panics. -// -// For more details see: -// https://github.com/rustwasm/console_error_panic_hook#readme -#[cfg(feature = "console_error_panic_hook")] -pub use console_error_panic_hook::set_once as set_panic_hook; - pub use self::api::Jason; pub use self::api::RoomHandle; -// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global -// allocator. -#[cfg(feature = "wee_alloc")] -#[global_allocator] -static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; +cfg_if! { + // When the `console_error_panic_hook` feature is enabled, we can call the + // `set_panic_hook` function to get better error messages if we ever panic. + if #[cfg(feature = "console_error_panic_hook")] { + pub use console_error_panic_hook::set_once as set_panic_hook; + } else { + #[inline] + pub fn set_panic_hook() {} + } +} + +cfg_if! { + // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global + // allocator. + if #[cfg(feature = "wee_alloc")] { + #[global_allocator] + static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; + } +} diff --git a/jason/src/rpc/websocket.rs b/jason/src/rpc/websocket.rs index a51c77656..0ba6dd38a 100644 --- a/jason/src/rpc/websocket.rs +++ b/jason/src/rpc/websocket.rs @@ -143,10 +143,9 @@ impl WebSocket { inner_mut.on_message = Some(EventListener::new_mut( Rc::clone(&inner_mut.socket), "message", - move |msg| { + move |msg: MessageEvent| { let parsed = - ServerMessage::try_from(&msg).map(std::convert::Into::into); - + msg.data().into_serde::().map_err(WasmErr::from); f(parsed); }, )?); @@ -216,23 +215,3 @@ impl From<&CloseEvent> for CloseMsg { } } } - -macro_attr! { - #[derive(NewtypeFrom!)] - pub struct ServerMessage(ServerMsg); -} - -impl TryFrom<&MessageEvent> for ServerMessage { - type Error = WasmErr; - - fn try_from(msg: &MessageEvent) -> Result { - let payload = msg - .data() - .as_string() - .ok_or_else(|| WasmErr::from_str("Payload is not string"))?; - - serde_json::from_str::(&payload) - .map_err(WasmErr::from) - .map(Self::from) - } -} From ad55aa39d2203805c7cd96e5502118d5a9f86d8d Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 21 May 2019 17:01:15 +0300 Subject: [PATCH 175/179] Remove wee_alloc feature and lto --- Cargo.toml | 1 - jason/Cargo.toml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bc705cb1c..22acfbaf4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ members = [ ] [profile.release] -lto = true opt-level = "s" # Tell `rustc` to optimize for small code size. [dependencies] diff --git a/jason/Cargo.toml b/jason/Cargo.toml index 47f8d896c..00a92a978 100644 --- a/jason/Cargo.toml +++ b/jason/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/instrumentisto/medea" crate-type = ["cdylib", "rlib"] [features] -default = ["console_error_panic_hook", "wee_alloc"] +default = ["console_error_panic_hook"] [dependencies] cfg-if = "0.1" From ab6ed6dac06b7501ce577d4db554f72fc50cee9d Mon Sep 17 00:00:00 2001 From: Kirguir Date: Tue, 21 May 2019 17:12:41 +0300 Subject: [PATCH 176/179] Remove obsolete code --- jason/src/rpc/pinger.rs | 101 ---------------------------------------- 1 file changed, 101 deletions(-) delete mode 100644 jason/src/rpc/pinger.rs diff --git a/jason/src/rpc/pinger.rs b/jason/src/rpc/pinger.rs deleted file mode 100644 index cbcac1cde..000000000 --- a/jason/src/rpc/pinger.rs +++ /dev/null @@ -1,101 +0,0 @@ -use protocol::ClientMsg; -use wasm_bindgen::{prelude::*, JsCast}; - -use std::{cell::RefCell, rc::Rc}; - -use crate::{ - rpc::websocket::WebSocket, - utils::{window, IntervalHandle, WasmErr}, -}; - -/// Responsible for sending/handling keep-alive requests, detecting connection -/// loss. -pub struct Pinger(Rc>); - -struct InnerPinger { - /// Interval for send ping message. - ping_interval: i32, - - /// Count of ping message sending to server. - num: u64, - - /// Count of pong message received from server. - pong_at: Option, - - /// Socket to server. - socket: Option>, - - /// Handler for bind closure what run when ping send. - ping_task: Option, -} - -impl InnerPinger { - /// Send ping message into socket. - /// Returns error no open socket. - fn send_now(&mut self) -> Result<(), WasmErr> { - match self.socket.as_ref() { - None => Err(WasmErr::from_str("Unable to ping: no socket")), - Some(socket) => { - self.num += 1; - socket.send(&ClientMsg::Ping(self.num)) - } - } - } -} - -/// Handler for bind closure what run when ping send. -struct PingTaskHandler { - _ping_closure: Closure, - _interval_handler: IntervalHandle, -} - -impl Pinger { - /// Returns new instance of [`Pinger`] with given interval for ping in - /// seconds. - pub fn new(ping_interval: i32) -> Self { - Self(Rc::new(RefCell::new(InnerPinger { - ping_interval, - num: 0, - pong_at: None, - socket: None, - ping_task: None, - }))) - } - - /// Start [`Pinger`] for given [`WebSocket`]. Sends first ping immediately, - /// so will fail if provided [`WebSocket`] is not active. - pub fn start(&self, socket: Rc) -> Result<(), WasmErr> { - let mut inner = self.0.borrow_mut(); - inner.socket = Some(socket); - inner.send_now()?; - - let inner_rc = Rc::clone(&self.0); - let do_ping = Closure::wrap(Box::new(move || { - // its_ok if ping fails few times - let _ = inner_rc.borrow_mut().send_now(); - }) as Box); - - let interval_id = window() - .set_interval_with_callback_and_timeout_and_arguments_0( - do_ping.as_ref().unchecked_ref(), - inner.ping_interval, - )?; - - inner.ping_task = Some(PingTaskHandler { - _ping_closure: do_ping, - _interval_handler: IntervalHandle(interval_id), - }); - - Ok(()) - } - - /// Timestamp of last pong received. - pub fn set_pong_at(&self, at: f64) { - self.0.borrow_mut().pong_at = Some(at); - } - - /// Stop [`Pinger`]. - pub fn stop(&self) { - self.0.borrow_mut().ping_task.take(); - } -} From 019e19e5d87a2bc407b2d74deea3b28169416bcc Mon Sep 17 00:00:00 2001 From: alexlapa Date: Thu, 11 Jul 2019 20:38:55 +0300 Subject: [PATCH 177/179] update deps locks --- Cargo.lock | 941 ++++++++++++++++++++++++++++------------------------- 1 file changed, 494 insertions(+), 447 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 208434b44..d3ff1f875 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6,7 +6,7 @@ version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -14,21 +14,21 @@ name = "actix" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "actix-http 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-rt 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (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)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.3.1 (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)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -41,8 +41,8 @@ version = "0.1.2" 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.27 (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.28 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (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)", ] @@ -54,12 +54,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-utils 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.14.1 (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.27 (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)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-resolver 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -67,7 +67,7 @@ dependencies = [ [[package]] name = "actix-http" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -75,34 +75,34 @@ dependencies = [ "actix-server-config 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-utils 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.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)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "copyless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)", + "flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "language-tags 0.2.2 (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)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (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)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -119,20 +119,20 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-rt 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "actix-server 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-utils 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "awc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "awc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.2 (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)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (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)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -148,21 +148,21 @@ 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)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "string 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-rt" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -172,14 +172,14 @@ name = "actix-server" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "actix-rt 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "actix-server-config 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (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.28 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.10.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-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -193,7 +193,7 @@ name = "actix-server-config" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -203,7 +203,7 @@ name = "actix-service" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -212,57 +212,57 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (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)", - "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.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.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-utils" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "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.27 (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.28 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "actix-web" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-http 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "actix-router 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-rt 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-rt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "actix-server 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-server-config 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "actix-threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-utils 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-utils 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web-codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "awc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "awc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", - "encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.5.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.7 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (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)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -270,15 +270,15 @@ dependencies = [ [[package]] name = "actix-web-actors" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-http 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-web 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -286,8 +286,8 @@ name = "actix-web-codegen" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -296,8 +296,8 @@ version = "0.4.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.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -315,10 +315,10 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -337,7 +337,7 @@ dependencies = [ [[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)", @@ -345,7 +345,7 @@ dependencies = [ [[package]] name = "ascii" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -353,8 +353,8 @@ name = "atty" version = "0.2.11" 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.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (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)", ] @@ -365,45 +365,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "awc" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-http 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "derive_more 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "derive_more 0.15.0 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (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)", "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace" -version = "0.3.30" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace-sys 0.1.30 (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.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace-sys" -version = "0.1.28" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.37 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -411,7 +410,7 @@ name = "base64" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -419,8 +418,8 @@ name = "bb8" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -430,14 +429,14 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bb8 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "redis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "bitflags" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -445,7 +444,7 @@ name = "blake2-rfc" version = "0.2.18" 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)", "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -455,7 +454,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.37 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -464,22 +463,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "brotli-sys 0.3.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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "build_const" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bumpalo" -version = "2.4.3" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "byteorder" -version = "1.3.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -487,10 +481,19 @@ name = "bytes" version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (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.3.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 = "cc" version = "1.0.37" @@ -503,9 +506,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chrono" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -516,7 +520,7 @@ name = "cloudabi" version = "0.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -524,10 +528,10 @@ name = "combine" version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ascii 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ascii 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", + "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)", - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -539,9 +543,9 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -552,7 +556,7 @@ version = "0.1.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)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -562,16 +566,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "copyless" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "crc" -version = "1.8.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "crc32fast" @@ -597,7 +593,7 @@ 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)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.10.0 (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)", ] @@ -607,7 +603,7 @@ version = "0.3.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)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -633,7 +629,7 @@ name = "crossbeam-epoch" version = "0.7.1" 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)", @@ -664,9 +660,9 @@ version = "0.14.1" 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)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -676,10 +672,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -687,7 +683,7 @@ name = "dirs" version = "1.0.5" 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.59 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -699,7 +695,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -769,25 +765,33 @@ name = "encoding_index_tests" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "encoding_rs" +version = "0.8.17" +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)", +] + [[package]] name = "enum-as-inner" version = "0.2.1" 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.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "env_logger" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -796,7 +800,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -806,20 +810,20 @@ version = "0.1.5" 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.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "flate2" -version = "1.0.7" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crc32fast 1.2.0 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide_c_api 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -837,7 +841,7 @@ name = "fuchsia-zircon" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -848,7 +852,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -856,20 +860,29 @@ name = "gcc" version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "getrandom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "h2" -version = "0.1.23" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.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)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (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)", + "log 0.4.7 (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.0 (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)", ] @@ -878,7 +891,7 @@ name = "hashbrown" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -905,7 +918,7 @@ name = "hostname" version = "0.1.5" 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.59 (registry+https://github.com/rust-lang/crates.io-index)", "winutil 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -921,7 +934,7 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.3" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -952,7 +965,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.59 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -967,17 +980,6 @@ dependencies = [ "winreg 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "isatty" -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)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itoa" version = "0.4.4" @@ -987,27 +989,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "jason" version = "0.1.0-dev" dependencies = [ + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "macro-attr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "medea-client-api-proto 0.1.0-dev", - "newtype_derive 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-futures 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-test 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-test 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "wee_alloc 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "js-sys" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1033,10 +1034,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "libc" -version = "0.2.58" +version = "0.2.59" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1075,12 +1079,12 @@ name = "log" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "log" -version = "0.4.6" +version = "0.4.7" 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)", @@ -1109,17 +1113,17 @@ name = "medea" version = "0.1.0-dev" dependencies = [ "actix 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-http 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-http 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "actix-http-test 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-web 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "actix-web-actors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "actix-web-actors 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "bb8 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bb8-redis 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "dotenv 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "macro-attr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1129,19 +1133,19 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "redis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde-humantime 0.1.1 (git+https://github.com/tailhook/serde-humantime?branch=serde_wrapper)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serial_test_derive 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "smart-default 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1150,8 +1154,8 @@ name = "medea-client-api-proto" version = "0.1.0-dev" dependencies = [ "medea-macro 0.1.0-dev", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1160,8 +1164,8 @@ version = "0.1.0-dev" dependencies = [ "Inflector 0.11.4 (registry+https://github.com/rust-lang/crates.io-index)", "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.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1169,12 +1173,12 @@ name = "memchr" version = "0.1.11" 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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "memchr" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1201,12 +1205,12 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.37 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "miniz_oxide" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1214,13 +1218,13 @@ dependencies = [ [[package]] name = "miniz_oxide_c_api" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", - "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz_oxide 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1232,8 +1236,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.59 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (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)", @@ -1246,7 +1250,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.59 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1267,7 +1271,7 @@ 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)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1289,7 +1293,7 @@ name = "nom" version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1320,10 +1324,10 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.10.0" +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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1363,10 +1367,10 @@ 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.59 (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.9 (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)", ] @@ -1377,11 +1381,11 @@ 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.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (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.9 (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)", ] @@ -1390,6 +1394,11 @@ name = "percent-encoding" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ppv-lite86" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro2" version = "0.4.30" @@ -1405,7 +1414,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "quote" -version = "0.6.12" +version = "0.6.13" 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)", @@ -1416,7 +1425,7 @@ name = "rand" version = "0.3.23" 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.59 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1426,7 +1435,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "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)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (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)", @@ -1438,7 +1447,7 @@ 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)", + "libc 0.2.59 (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_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1450,6 +1459,18 @@ dependencies = [ "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_chacha" version = "0.1.1" @@ -1459,6 +1480,16 @@ dependencies = [ "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rand_chacha" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "c2-chacha 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -1472,6 +1503,14 @@ name = "rand_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "rand_core" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "getrandom 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_hc" version = "0.1.0" @@ -1480,6 +1519,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.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rand_isaac" version = "0.1.1" @@ -1493,7 +1540,7 @@ 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)", + "libc 0.2.59 (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)", ] @@ -1505,7 +1552,7 @@ 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)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (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)", @@ -1543,10 +1590,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "combine 3.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "sha1 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1554,7 +1601,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.54" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1562,7 +1609,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1573,7 +1620,7 @@ dependencies = [ "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1590,14 +1637,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.1.6" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", + "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1607,7 +1654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "regex-syntax" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1628,7 +1675,7 @@ version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1667,7 +1714,7 @@ dependencies = [ [[package]] name = "ryu" -version = "0.2.8" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1715,10 +1762,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1729,7 +1776,7 @@ dependencies = [ "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1739,27 +1786,27 @@ version = "0.1.1" source = "git+https://github.com/tailhook/serde-humantime?branch=serde_wrapper#36b86d5ca09db3caf2edb06e0d46b505d0915792" dependencies = [ "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.92" +version = "1.0.94" 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.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_json" -version = "1.0.39" +version = "1.0.40" 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 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (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)", ] [[package]] @@ -1777,7 +1824,7 @@ 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.92 (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)", ] @@ -1794,8 +1841,8 @@ name = "serial_test_derive" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1808,7 +1855,7 @@ name = "signal-hook" version = "0.1.9" 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.59 (registry+https://github.com/rust-lang/crates.io-index)", "signal-hook-registry 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1818,7 +1865,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arc-swap 0.3.11 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1828,7 +1875,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "slog" -version = "2.4.1" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1836,7 +1883,7 @@ name = "slog-async" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1848,11 +1895,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "slog-term 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1860,10 +1907,10 @@ name = "slog-json" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1873,7 +1920,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1883,25 +1930,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "slog-term" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "smallvec" -version = "0.6.9" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1910,8 +1957,8 @@ version = "0.5.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)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1920,8 +1967,8 @@ version = "0.3.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)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (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)", ] @@ -1930,6 +1977,11 @@ name = "sourcefile" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "spin" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "stable_deref_trait" version = "1.1.1" @@ -1937,7 +1989,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "string" -version = "0.2.0" +version = "0.2.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)", @@ -1945,11 +1997,11 @@ dependencies = [ [[package]] name = "syn" -version = "0.15.34" +version = "0.15.39" 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)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1959,8 +2011,8 @@ version = "0.10.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)", - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1974,7 +2026,7 @@ name = "term" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1989,12 +2041,12 @@ dependencies = [ [[package]] name = "termion" -version = "1.5.2" +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)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.54 (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)", ] @@ -2004,7 +2056,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "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)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2028,7 +2080,7 @@ name = "threadpool" version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", + "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2036,31 +2088,30 @@ 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)", - "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (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)", ] [[package]] name = "tokio" -version = "0.1.21" +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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (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.0 (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)", "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.14 (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-trace-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2071,7 +2122,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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2080,17 +2131,17 @@ name = "tokio-current-thread" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (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-executor" -version = "0.1.7" +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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2098,9 +2149,9 @@ name = "tokio-fs" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (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.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2109,8 +2160,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.27 (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.28 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2119,16 +2170,16 @@ 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.27 (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)", + "log 0.4.7 (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.0 (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)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2136,12 +2187,12 @@ name = "tokio-signal" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.59 (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)", "signal-hook 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2149,11 +2200,11 @@ dependencies = [ [[package]] name = "tokio-sync" -version = "0.1.5" +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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2162,7 +2213,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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (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)", @@ -2171,18 +2222,18 @@ dependencies = [ [[package]] name = "tokio-threadpool" -version = "0.1.14" +version = "0.1.15" 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.27 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "num_cpus 1.10.0 (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.7 (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)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2191,17 +2242,9 @@ 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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-trace-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2210,8 +2253,8 @@ 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.27 (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.28 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (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)", @@ -2224,10 +2267,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.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (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.59 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.7 (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)", @@ -2240,7 +2283,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2248,17 +2291,17 @@ name = "trust-dns-proto" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "enum-as-inner 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (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)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "socket2 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2274,14 +2317,14 @@ 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)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "ipconfig 0.2.1 (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)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "trust-dns-proto 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2311,7 +2354,7 @@ name = "unicode-normalization" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2350,7 +2393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "utf8-ranges" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2365,113 +2408,112 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.45" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.45" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "bumpalo 2.5.0 (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)", + "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "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.34 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-futures" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.45" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.45" +version = "0.2.47" 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.34 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.45" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen-test" -version = "0.2.45" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-futures 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-test-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-futures 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-test-macro 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-test-macro" -version = "0.2.45" +version = "0.2.47" 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)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-webidl" -version = "0.2.45" +version = "0.2.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "heck 0.3.1 (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.7 (registry+https://github.com/rust-lang/crates.io-index)", "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.34 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "web-sys" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-webidl 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-webidl 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2480,7 +2522,7 @@ version = "0.4.4" 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)", + "libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)", "memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2583,52 +2625,51 @@ dependencies = [ "checksum actix 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "671ce3d27313f236827a5dd153a1073ad03ef31fc77f562020263e7830cf1ef7" "checksum actix-codec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9f2c11af4b06dc935d8e1b1491dad56bfb32febc49096a91e773f8535c176453" "checksum actix-connect 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7fbab0d79b2f3415a79570e3db12eaa75c26239541e613b832655145a5e9488" -"checksum actix-http 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "81aa906e74d2cd5f219f596003b0fd94d05e75a4a448b12afea66e7658b6c9e1" +"checksum actix-http 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "29c11d33772c790e9aeb2e024834bc084f7496598482908e2424efd768c912b6" "checksum actix-http-test 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e4ea476df1fe681a9bd2fcc37eff9393fad4a0430975e46d7c657907351f250" "checksum actix-router 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "23224bb527e204261d0291102cb9b52713084def67d94f7874923baefe04ccf7" -"checksum actix-rt 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ed0424cdf6542a43b32a8885c7c5099bf4110fad9b50d7fb220ab9c038ecf5ec" +"checksum actix-rt 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "61e09627004cb25149fd177c4a062d2061c4ec40aae5820ecd37a87195e759f8" "checksum actix-server 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ba8c936356c882420eab87051b12ca1926dc42348863d05fff7eb151df9cddbb" "checksum actix-server-config 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78703f07d0bd08b426b482d53569d84f1e1929024f0431b3a5a2dc0c1c60e0f" "checksum actix-service 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aaecc01bbc595ebd7a563a7d4f8a607d0b964bb55273c6f362b0b02c26508cf2" "checksum actix-threadpool 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1c29f7c554d56b3841f4bb85d5b3dee01ba536e1307679f56eb54de28aaec3fb" -"checksum actix-utils 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7ab47adc5e67fc83a0c58570b40531f09814a5daa969e0d913ebeab908a43508" -"checksum actix-web 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6478c837afbe528cfe468976e67b6b81a6330414b00234c4546a158f9f0739fc" -"checksum actix-web-actors 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c54489d9bcfce84a5096ba47db6a4dd2cc493987e97a987a4c5a7519b31f26d" +"checksum actix-utils 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b307201d074c963041cd8858d6b6a82ca23369827d613da5d6e972de123d3c14" +"checksum actix-web 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0dc7ab62d04b9eeb0f368ad9c6ee20c2e3541fb9a25a5eb727c9118b59e8ff2" +"checksum actix-web-actors 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8197aa04b8950ed9e37340cd46fe7ad3ccb8b1c4bbcef881ee5f6d149a425608" "checksum actix-web-codegen 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe9e3cdec1e645b675f354766e0688c5705021c85ab3cf739be1c8999b91c76" "checksum actix_derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bf5f6d7bf2d220ae8b4a7ae02a572bb35b7c4806b24049af905ab8110de156c" "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c" "checksum aho-corasick 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ca972c2ea5f742bfce5687b9aef75506a764f61d37f8f649047846a9686ddb66" -"checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" +"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" "checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" -"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" -"checksum ascii 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a5fc969a8ce2c9c0c4b0429bb8431544f6658283c8326ba5ff8c762b75369335" +"checksum arrayvec 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d73f9beda665eaa98ab9e4f7442bd4e7de6652587de55b2525e52e29c1b0ba" +"checksum ascii 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "91e320562a8fa3286a481b7189f89578ace6b20df99e123c87f2f509c957c5d6" "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 awc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c5133e9ca1d7f0560fb271f20286be3e896dac5736040a62a7ef1d62003160b6" -"checksum backtrace 0.3.30 (registry+https://github.com/rust-lang/crates.io-index)" = "ada4c783bb7e7443c14e0480f429ae2cc99da95065aeab7ee1b81ada0419404f" -"checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" +"checksum awc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4c4763e6aa29a801d761dc3464f081d439ea5249ba90c3c3bdfc8dd3f739d233" +"checksum backtrace 0.3.32 (registry+https://github.com/rust-lang/crates.io-index)" = "18b50f5258d1a9ad8396d2d345827875de4261b158124d4c819d9b351454fae5" +"checksum backtrace-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)" = "5b3a000b9c543553af61bc01cbfc403b04b5caa9e421033866f2e98061eb3e61" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bb8 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ac04c3b2d3327a583c9a93b6c5ab4316e6609f5ec84b71b89ebe518e0edbad2" "checksum bb8-redis 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9817f38c173f0da1581b923b90e66750a090413ad67a20980d5ad64141bab476" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum brotli-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4445dea95f4c2b41cde57cc9fee236ae4dbae88d8fcbdb4750fc1bb5d86aaecd" "checksum brotli2 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0cb036c3eade309815c15ddbacec5b22c4d1f3983a774ab2eac2e3e9ea85568e" -"checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum bumpalo 2.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "84dca3afd8e01b9526818b7963e5b4916063b3cdf9f10cf6b73ef0bd0ec37aa5" -"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" +"checksum bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2cd43d82f27d68911e6ee11ee791fb248f138f5d69424dc02e098d4f152b0b05" +"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 cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" +"checksum chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "77d81f58b7301084de3b958691458a53c3f7e0b1d702f77e550b6a88e3a88abe" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum combine 3.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" "checksum config 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f9107d78ed62b3fa5a86e7d18e647abed48cfd8f8fab6c72f4cdb982d196f7e6" "checksum console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum copyless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f8ffa29b14f03d473f1558c789d020fe41bb7790774f429ff818f4ed9a6f9a0e" -"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" +"checksum copyless 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ff9c56c9fb2a49c05ef0e431485a22400af20d33226dc0764d891d09e724127" "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" "checksum crossbeam 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd66663db5a988098a89599d4857919b3acf7f61402e61365acfd3919857b9be" "checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94" @@ -2651,55 +2692,56 @@ dependencies = [ "checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a" "checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18" "checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569" +"checksum encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)" = "4155785c79f2f6701f185eb2e6b4caf0555ec03477cb4c70db67b465311620ed" "checksum enum-as-inner 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3d58266c97445680766be408285e798d3401c6d4c378ec5552e78737e681e37d" -"checksum env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b61fa891024a945da30a9581546e8cfaf5602c7b3f4c137a2805cf388f92075a" +"checksum env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" -"checksum flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f87e68aa82b2de08a6e037f1385455759df6e445a8df5e005b4297191dbf18aa" +"checksum flate2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "550934ad4808d5d39365e5d61727309bf18b3b02c6c56b729cb92e7dd84bc3d8" "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.27 (registry+https://github.com/rust-lang/crates.io-index)" = "a2037ec1c6c1c4f79557762eab1f7eae1f64f6cb418ace90fae88f0942b60139" +"checksum futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "45dc39533a6cae6da2b56da48edae506bb767ec07370f86f70fc062e9d435869" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" -"checksum h2 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "1e42e3daed5a7e17b12a0c23b5b2fbff23a925a570938ebee4baca1a9a1a2240" +"checksum getrandom 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "e65cce4e5084b14874c4e7097f38cab54f47ee554f9194673456ea379dcc4c55" +"checksum h2 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "a539b63339fbbb00e081e84b6e11bd1d9634a82d91da2984a18ac74a8823f392" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum hashbrown 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "29fba9abe4742d586dfd0c06ae4f7e73a1c2d86b856933509b269d82cdf06e18" "checksum hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e1de41fb8dba9714efd92241565cdff73f78508c95697dd56787d3cba27e2353" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hostname 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e" "checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" -"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" +"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "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 iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum ipconfig 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa79fa216fbe60834a9c0737d7fcd30425b32d1c58854663e24d4c4b328ed83f" -"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" -"checksum js-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "9987e7c13a91d9cf0efe59cca48a3a7a70e2b11695d5a4640f85ae71e28f5e73" +"checksum js-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "eac16f41aa9b9388230b1d6617d7ed897a1af5416b8fe1c8734dcef79c7aae10" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" "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 libc 0.2.59 (registry+https://github.com/rust-lang/crates.io-index)" = "3262021842bf00fe07dbd6cf34ff25c99d7a7ebef8deea84db72be3ea3bb0aff" "checksum linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d262045c5b87c0861b3f004610afd0e2c851e2908d08b6c870cbb9d5f494ecd" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3" "checksum lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" "checksum macro-attr 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00e51c6f0e2bf862b01b3d784fc32b02feb248a69062c51fb0b6d14cd526cc2a" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" -"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" +"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" "checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" "checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425" "checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" -"checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e" -"checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab" +"checksum miniz_oxide 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b6c3756d66cf286314d5f7ebe74886188a9a92f5eee68b06f31ac2b4f314c99d" +"checksum miniz_oxide_c_api 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5b78ca5446dd9fe0dab00e058731b6b08a8c1d2b9cdb8efb10876e24e9ae2494" "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" @@ -2710,7 +2752,7 @@ dependencies = [ "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" "checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" -"checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" +"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 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" @@ -2718,16 +2760,21 @@ dependencies = [ "checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum ppv-lite86 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e3cbf9f658cdb5000fcf6f362b8ea2ba154b9f146a61c7a20d647034c6b6561b" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" +"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +"checksum rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d47eab0e83d9693d40f825f86948aa16eff6750ead4bdffc4ab95b8b3a7f052c" "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +"checksum rand_chacha 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e193067942ef6f485a349a113329140d0ab9e2168ce92274499bb0e9a4190d9d" "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.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "615e683324e75af5d43d8f7a39ffe3ee4a9dc42c5c701167a71dc59c3a493aca" "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" @@ -2735,13 +2782,13 @@ dependencies = [ "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redis 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b543b95de413ac964ca609e91fd9fd58419312e69988fb197f3ff8770312a1af" -"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" +"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 redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" -"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" +"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad" "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" -"checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" +"checksum regex-syntax 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9b01330cce219c1c6b2e209e5ed64ccd587ae5c67bed91c0b49eecf02ae40e21" "checksum resolv-conf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b263b4aa1b5de9ffc0054a2386f96992058bb6870aab516f8cdeb8a667d56dcb" "checksum rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f76d05d3993fd5f4af9434e8e436db163a12a9d40e1a58a726f27a01dfd12a2a" "checksum rust-ini 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e52c148ef37f8c375d49d5a73aa70713125b7f19095948a923f80afdeb22ec2" @@ -2749,7 +2796,7 @@ dependencies = [ "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" +"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "checksum scoped-tls 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" "checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" @@ -2758,11 +2805,11 @@ dependencies = [ "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 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "9dad3f759919b92c3068c696c15c3d17238234498bbdcc80f2c469606f948ac8" -"checksum serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "32746bf0f26eab52f06af0d0aa1984f641341d06d8d673c693871da2d188c9be" +"checksum serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "076a696fdea89c19d3baed462576b8f6d663064414b5c793642da8dfeb99475b" "checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153" "checksum serde-humantime 0.1.1 (git+https://github.com/tailhook/serde-humantime?branch=serde_wrapper)" = "" -"checksum serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "46a3223d0c9ba936b61c0d2e3e559e3217dbfb8d65d06d26e8b3c25de38bae3e" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "ef45eb79d6463b22f5f9e16d283798b7c0175ba6050bc25c1a946c122727fe7b" +"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum serde_test 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)" = "110b3dbdf8607ec493c22d5d947753282f3bae73c0f56d322af1e8c78e4c23d5" "checksum serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "642dd69105886af2efd227f75a520ec9b44a820d65bc133a9131f7d229fd165a" "checksum serial_test 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "50bfbc39343545618d97869d77f38ed43e48dd77432717dbc7ed39d797f3ecbe" @@ -2771,43 +2818,43 @@ dependencies = [ "checksum signal-hook 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "72ab58f1fda436857e6337dcb6a5aaa34f16c5ddc87b3a8b6ef7a212f90b9c5a" "checksum signal-hook-registry 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cded4ffa32146722ec54ab1f16320568465aa922aa9ab4708129599740da85d7" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" -"checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" +"checksum slog 2.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c03967c75a664f050d3400ab3bce3e4c4f427620e54f6ce61bee1cbe307b0cd2" "checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" "checksum slog-envlogger 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f7c6685180086bf58624e92cb3da5d5f013bebd609454926fc8e2ac6345d384b" "checksum slog-json 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddc0d2aff1f8f325ef660d9a0eb6e6dcd20b30b3f581a5897f58bf42d061c37a" "checksum slog-scope 4.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "60c04b4726fa04595ccf2c2dad7bcd15474242c4c5e109a8a376e8a2c9b1539a" "checksum slog-stdlog 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac42f8254ae996cc7d640f9410d3b048dcdf8887a10df4d5d4c44966de24c4a8" -"checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" -"checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" +"checksum slog-term 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb9b3fd9a3c2c86580fce3558a98ed7c69039da0288b08a3f15b371635254e08" +"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum smart-default 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9dbd5f03d04e80355cbbe3ce5cf1f65c421eac575402e3d4d6e95d5a44edaa" "checksum socket2 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "4e626972d3593207547f14bf5fc9efa4d0e7283deb73fef1dff313dae9ab8878" "checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" +"checksum spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44363f6f51401c34e7be73db0db371c04705d35efbe9f7d6082e03a921a32c55" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" -"checksum string 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0bbfb8937e38e34c3444ff00afb28b0811d9554f15c5ad64d12b0308d1d1995" -"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" +"checksum syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d960b829a55e56db167e861ddb43602c003c7be0bee1d345021703fac2fb7c" "checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" -"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" +"checksum termion 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6a8fb22f7cde82c8220e5aeacb3258ed7ce996142c77cba193f203515e26c330" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" "checksum thread_local 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "8576dbbfcaef9641452d5cf0df9b0e7eeab7694956dd33bb61515fb8f18cfdd5" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum threadpool 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e2f0c90a5f3459330ac8bc0d2f879c693bb7a2f59689c1083fc4ef83834da865" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ec2ffcf4bcfc641413fa0f1427bf8f91dfc78f56a6559cbf50e04837ae442a87" +"checksum tokio 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" "checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f" "checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" -"checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e" +"checksum tokio-executor 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f27ee0e6db01c5f0b2973824547ce7e637b2ed79b891a9677b0de9bd532b6ac" "checksum tokio-fs 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe6dc22b08d6993916647d108a1a7d15b9cd29c4f4496c62b92c45b5041b7af" "checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" "checksum tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6af16bfac7e112bea8b0442542161bfc41cbfa4466b580bdda7d18cb88b911ce" "checksum tokio-signal 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "dd6dc5276ea05ce379a16de90083ec80836440d5ef8a6a39545a3207373b8296" -"checksum tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2f843ffdf8d6e1f90bddd48da43f99ab071660cd92b7ec560ef3cdfd7a409a" +"checksum tokio-sync 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2162248ff317e2bc713b261f242b69dbb838b85248ed20bb21df56d60ea4cae7" "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" -"checksum tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2" +"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-trace-core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9c8a256d6956f7cb5e2bdfe8b1e8022f1a09206c6c2b1ba00f3b746b260c613" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" @@ -2822,19 +2869,19 @@ dependencies = [ "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" -"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" +"checksum utf8-ranges 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9d50aa7650df78abf942826607c62468ce18d9019673d4a2ebe1865dbb96ffde" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" -"checksum wasm-bindgen 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ccc7b93cfd13e26700a9e2e41e6305f1951b87e166599069f77d10358100e6" -"checksum wasm-bindgen-backend 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1953f91b1608eb1522513623c7739f047bb0fed4128ce51a93f08e12cc314645" -"checksum wasm-bindgen-futures 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "fa1af11c73eca3dc8c51c76ea475a4416e912da6402064a49fc6c0214701866d" -"checksum wasm-bindgen-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "0f69da5696545d7ca6607a2e4b1a0edf5a6b36b2c49dbb0f1df6ad1d92884047" -"checksum wasm-bindgen-macro-support 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d4246f3bc73223bbb846f4f2430a60725826a96c9389adf715ed1d5af46dec6" -"checksum wasm-bindgen-shared 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "c08381e07e7a79e5e229ad7c60d15833d19033542cc5dd91d085df59d235f4a6" -"checksum wasm-bindgen-test 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2a2a27d7a833564ec141078b3a71fb9ef00573e38e3f2fc1a5bb5221bb41c8bd" -"checksum wasm-bindgen-test-macro 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "e5c0eac6c5b18d1b73614ddd080986bd01fa5c24fa9bd95c92dffe514f207355" -"checksum wasm-bindgen-webidl 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "1f42ff7adb8102bf5ad8adbc45b1635c520c8175f9fdf6eb2c54479d485d435a" -"checksum web-sys 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "540b8259eb242ff3a566fa0140bda03a4ece4e5c226e1284b5c95dddcd4341f6" +"checksum wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "22029998cc650473cb05f10f19c06a1536b9e1f1572e4f5dacd45ab4d3f85877" +"checksum wasm-bindgen-backend 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "6f858ff3cb4196c702e8c24b75fba1d3ab46958de4f7c253627f0507aae1507c" +"checksum wasm-bindgen-futures 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "cc16facd42fc3d0fa0cae78b39516bac04496cf80518fd09bbfa33e9b0e9c92d" +"checksum wasm-bindgen-macro 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "15c29f04eb117312931e7b02878453ee63d67a6f291797651890128bf5ee71db" +"checksum wasm-bindgen-macro-support 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "92b1356b623816248dfe0e2c4b7e113618d647808907ff6a3d9838ebee8e82ee" +"checksum wasm-bindgen-shared 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "15de16ddb30cfd424a87598b30021491bae1607d32e52056979865c98b7913b4" +"checksum wasm-bindgen-test 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "7dcceff686a33d286a139c7634aae6d821835bf9cd69bc186bd28e08bd4cc9f0" +"checksum wasm-bindgen-test-macro 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "0e50836aa591b9f552c8b2c364cca72c3f8fd40e4104d4551c1d9ac5b5bef3d3" +"checksum wasm-bindgen-webidl 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "21724123084234fff2f986018b790afc5d6f45c9a3903025e6c55d0068cb7d15" +"checksum web-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "22306ce642c58266cb5c5938150194911322bc179aa895146076217410ddbc82" "checksum wee_alloc 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "31d4e6572d21ac55398bc91db827f48c3fdb8152ae60f4c358f6780e1035ffcc" "checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e" "checksum widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" From e155905a113a1c682b7f73a0e3da9bd251c4130b Mon Sep 17 00:00:00 2001 From: alexlapa Date: Thu, 11 Jul 2019 20:53:11 +0300 Subject: [PATCH 178/179] remove cfg_if and wee_alloc --- Cargo.lock | 21 --------------------- jason/Cargo.toml | 2 -- jason/src/lib.rs | 24 ++++-------------------- jason/src/rpc/websocket.rs | 2 +- 4 files changed, 5 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3ff1f875..2c3fac611 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -989,7 +989,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "jason" version = "0.1.0-dev" dependencies = [ - "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "console_error_panic_hook 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "js-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1000,7 +999,6 @@ dependencies = [ "wasm-bindgen-futures 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen-test 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "web-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "wee_alloc 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1186,11 +1184,6 @@ name = "memoffset" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "memory_units" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "mime" version = "0.3.13" @@ -2516,18 +2509,6 @@ dependencies = [ "wasm-bindgen-webidl 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "wee_alloc" -version = "0.4.4" -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.59 (registry+https://github.com/rust-lang/crates.io-index)", - "memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "weedle" version = "0.9.0" @@ -2737,7 +2718,6 @@ dependencies = [ "checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum memory_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8452105ba047068f40ff7093dd1d9da90898e63dd61736462e9cdda6a90ad3c3" "checksum mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)" = "3e27ca21f40a310bd06d9031785f4801710d566c184a6e15bad4f1d9b65f9425" "checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" "checksum miniz_oxide 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b6c3756d66cf286314d5f7ebe74886188a9a92f5eee68b06f31ac2b4f314c99d" @@ -2882,7 +2862,6 @@ dependencies = [ "checksum wasm-bindgen-test-macro 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "0e50836aa591b9f552c8b2c364cca72c3f8fd40e4104d4551c1d9ac5b5bef3d3" "checksum wasm-bindgen-webidl 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "21724123084234fff2f986018b790afc5d6f45c9a3903025e6c55d0068cb7d15" "checksum web-sys 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "22306ce642c58266cb5c5938150194911322bc179aa895146076217410ddbc82" -"checksum wee_alloc 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "31d4e6572d21ac55398bc91db827f48c3fdb8152ae60f4c358f6780e1035ffcc" "checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e" "checksum widestring 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effc0e4ff8085673ea7b9b2e3c73f6bd4d118810c9009ed8f1e16bd96c331db6" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/jason/Cargo.toml b/jason/Cargo.toml index 00a92a978..0e1cda705 100644 --- a/jason/Cargo.toml +++ b/jason/Cargo.toml @@ -15,7 +15,6 @@ crate-type = ["cdylib", "rlib"] default = ["console_error_panic_hook"] [dependencies] -cfg-if = "0.1" console_error_panic_hook = { version = "0.1", optional = true } futures = "0.1" js-sys = "0.3" @@ -24,7 +23,6 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" wasm-bindgen = { version = "0.2", features = ["serde-serialize"] } wasm-bindgen-futures = "0.3" -wee_alloc = { version = "0.4", optional = true } [dependencies.web-sys] version = "0.3.4" features = [ diff --git a/jason/src/lib.rs b/jason/src/lib.rs index 8058873cd..540a8a3cf 100644 --- a/jason/src/lib.rs +++ b/jason/src/lib.rs @@ -1,5 +1,3 @@ -use cfg_if::cfg_if; - mod api; mod rpc; mod utils; @@ -7,22 +5,8 @@ mod utils; #[doc(inline)] pub use self::api::{Jason, RoomHandle}; -cfg_if! { - // When the `console_error_panic_hook` feature is enabled, we can call the - // `set_panic_hook` function to get better error messages if we ever panic. - if #[cfg(feature = "console_error_panic_hook")] { - pub use console_error_panic_hook::set_once as set_panic_hook; - } else { - #[inline] - pub fn set_panic_hook() {} - } -} +#[cfg(feature = "console_error_panic_hook")] +pub use console_error_panic_hook::set_once as set_panic_hook; -cfg_if! { - // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global - // allocator. - if #[cfg(feature = "wee_alloc")] { - #[global_allocator] - static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; - } -} +#[cfg(not(feature = "console_error_panic_hook"))] +pub fn set_panic_hook() {} diff --git a/jason/src/rpc/websocket.rs b/jason/src/rpc/websocket.rs index 988aed4ee..b07143e10 100644 --- a/jason/src/rpc/websocket.rs +++ b/jason/src/rpc/websocket.rs @@ -214,4 +214,4 @@ impl From<&CloseEvent> for CloseMsg { _ => CloseMsg::Disconnect(body), } } -} \ No newline at end of file +} From 60400a830e061a6fe3bb5af031231dcc96bb2553 Mon Sep 17 00:00:00 2001 From: alexlapa Date: Fri, 12 Jul 2019 14:59:54 +0300 Subject: [PATCH 179/179] fix make test --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index db69fe7bf..c505e24cd 100644 --- a/Makefile +++ b/Makefile @@ -170,7 +170,6 @@ ifeq ($(test-unit-crate),medea) else ifeq ($(test-unit-crate),jason) wasm-pack test --headless --firefox jason - cargo test -p jason endif cargo test -p $(test-unit-crate) endif