diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2018-06-06 11:40:57 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2018-06-06 13:16:49 +0200 |
commit | adef51556f04576e4c34a77dfc52b461770c7ff9 (patch) | |
tree | 8765eb5bf783276b68163612f1814532085b0b5b | |
parent | 3febc0a82aebbb70cdfa623f5d6ce0306583ec84 (diff) |
net, store: Bump rand to "0.5" and adapt code accordingly.
-rw-r--r-- | net/Cargo.toml | 2 | ||||
-rw-r--r-- | net/src/ipc.rs | 2 | ||||
-rw-r--r-- | net/tests/hkp.rs | 2 | ||||
-rw-r--r-- | store/Cargo.toml | 2 | ||||
-rw-r--r-- | store/src/backend/mod.rs | 6 |
5 files changed, 8 insertions, 6 deletions
diff --git a/net/Cargo.toml b/net/Cargo.toml index c48a7be9..061ece30 100644 --- a/net/Cargo.toml +++ b/net/Cargo.toml @@ -17,7 +17,7 @@ hyper-tls = "0.2" libc = "0.2.33" native-tls = "0.1.4" percent-encoding = "1.0.1" -rand = "0.4" +rand = "0.5" tokio-core = "0.1" tokio-io = "0.1.4" url = "1.6.0" diff --git a/net/src/ipc.rs b/net/src/ipc.rs index ba962b70..33afe3bf 100644 --- a/net/src/ipc.rs +++ b/net/src/ipc.rs @@ -391,7 +391,7 @@ impl Server { struct Cookie(Vec<u8>); extern crate rand; -use self::rand::Rng; +use self::rand::RngCore; use self::rand::os::OsRng; const COOKIE_SIZE: usize = 32; diff --git a/net/tests/hkp.rs b/net/tests/hkp.rs index b2d68bb0..4acbf56d 100644 --- a/net/tests/hkp.rs +++ b/net/tests/hkp.rs @@ -12,7 +12,7 @@ use http::{Request, Response}; use hyper::{Server, Body}; use hyper::service::service_fn; use hyper::{Method, StatusCode}; -use rand::Rng; +use rand::RngCore; use rand::os::OsRng; use std::io::Cursor; use std::net::{SocketAddr, IpAddr, Ipv4Addr}; diff --git a/store/Cargo.toml b/store/Cargo.toml index d7d3664d..816adff1 100644 --- a/store/Cargo.toml +++ b/store/Cargo.toml @@ -16,7 +16,7 @@ capnp = "0.8" capnp-rpc = "0.8" failure = "0.1.1" futures = "0.1.17" -rand = "0.4" +rand = "0.5" rusqlite = "0.13" time = "0.1.38" tokio-core = "0.1.10" diff --git a/store/src/backend/mod.rs b/store/src/backend/mod.rs index 51bd52fb..1e60dc29 100644 --- a/store/src/backend/mod.rs +++ b/store/src/backend/mod.rs @@ -13,7 +13,7 @@ use capnp_rpc::rpc_twoparty_capnp::Side; use capnp_rpc::{self, RpcSystem, twoparty}; use futures::Future; use futures::future::{self, loop_fn, Loop}; -use rand::distributions::{IndependentSample, Range}; +use rand::distributions::{Distribution, Uniform}; use rand::thread_rng; use rusqlite::Connection; use rusqlite; @@ -53,7 +53,9 @@ fn refresh_interval() -> Duration { /// /// This function is used to randomize key refresh times. fn random_duration(d: Duration) -> Duration { - Duration::seconds(Range::new(0, 2 * d.num_seconds()).ind_sample(&mut thread_rng())) + let s = Uniform::from(0..2 * d.num_seconds()) + .sample(&mut thread_rng()); + Duration::seconds(s) } /* Entry point. */ |