diff options
author | Steven Fackler <sfackler@gmail.com> | 2019-06-10 12:54:27 -0700 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2019-06-10 12:54:27 -0700 |
commit | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b (patch) | |
tree | 12cf723d0408074d1ea27d02ca02ed616b90bdaf /tokio-tls | |
parent | 5c0b56278b95a16f2f0b6dedfffe730b39d52948 (diff) |
Make threadpool::Runtime methods take &self (#1140)
The runtime is inherently multi-threaded, so it's going to have to deal
with synchronization when submitting new tasks anyway. This allows a
runtime to be shared by multiple threads more easily when e.g. building
a blocking facade over a tokio-based API.
Diffstat (limited to 'tokio-tls')
-rw-r--r-- | tokio-tls/examples/download-rust-lang.rs | 2 | ||||
-rw-r--r-- | tokio-tls/tests/bad.rs | 2 | ||||
-rw-r--r-- | tokio-tls/tests/google.rs | 4 | ||||
-rw-r--r-- | tokio-tls/tests/smoke.rs | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/tokio-tls/examples/download-rust-lang.rs b/tokio-tls/examples/download-rust-lang.rs index 08e463bf..62e91743 100644 --- a/tokio-tls/examples/download-rust-lang.rs +++ b/tokio-tls/examples/download-rust-lang.rs @@ -10,7 +10,7 @@ use tokio_io; use tokio_tls; fn main() -> Result<(), Box<dyn std::error::Error>> { - let mut runtime = Runtime::new()?; + let runtime = Runtime::new()?; let addr = "www.rust-lang.org:443" .to_socket_addrs()? .next() diff --git a/tokio-tls/tests/bad.rs b/tokio-tls/tests/bad.rs index e72b2d23..954593b0 100644 --- a/tokio-tls/tests/bad.rs +++ b/tokio-tls/tests/bad.rs @@ -89,7 +89,7 @@ fn get_host(host: &'static str) -> Error { let addr = format!("{}:443", host); let addr = t!(addr.to_socket_addrs()).next().unwrap(); - let mut l = t!(Runtime::new()); + let l = t!(Runtime::new()); let client = TcpStream::connect(&addr); let data = client.and_then(move |socket| { let builder = TlsConnector::builder(); diff --git a/tokio-tls/tests/google.rs b/tokio-tls/tests/google.rs index 15346d4c..b76c1085 100644 --- a/tokio-tls/tests/google.rs +++ b/tokio-tls/tests/google.rs @@ -63,7 +63,7 @@ fn fetch_google() { let addr = t!("google.com:443".to_socket_addrs()).next().unwrap(); // Create an event loop and connect a socket to our resolved address.c - let mut l = t!(Runtime::new()); + let l = t!(Runtime::new()); let client = TcpStream::connect(&addr); // Send off the request by first negotiating an SSL handshake, then writing @@ -97,7 +97,7 @@ fn wrong_hostname_error() { let addr = t!("google.com:443".to_socket_addrs()).next().unwrap(); - let mut l = t!(Runtime::new()); + let l = t!(Runtime::new()); let client = TcpStream::connect(&addr); let data = client.and_then(move |socket| { let builder = TlsConnector::builder(); diff --git a/tokio-tls/tests/smoke.rs b/tokio-tls/tests/smoke.rs index 18d5dde8..76564d9b 100644 --- a/tokio-tls/tests/smoke.rs +++ b/tokio-tls/tests/smoke.rs @@ -507,7 +507,7 @@ const AMT: u64 = 128 * 1024; #[test] fn client_to_server() { drop(env_logger::try_init()); - let mut l = t!(Runtime::new()); + let l = t!(Runtime::new()); // Create a server listening on a port, then figure out what that port is let srv = t!(TcpListener::bind(&t!("127.0.0.1:0".parse()))); @@ -540,7 +540,7 @@ fn client_to_server() { #[test] fn server_to_client() { drop(env_logger::try_init()); - let mut l = t!(Runtime::new()); + let l = t!(Runtime::new()); // Create a server listening on a port, then figure out what that port is let srv = t!(TcpListener::bind(&t!("127.0.0.1:0".parse()))); @@ -597,7 +597,7 @@ impl<S: AsyncWrite> AsyncWrite for OneByte<S> { fn one_byte_at_a_time() { const AMT: u64 = 1024; drop(env_logger::try_init()); - let mut l = t!(Runtime::new()); + let l = t!(Runtime::new()); let srv = t!(TcpListener::bind(&t!("127.0.0.1:0".parse()))); let addr = t!(srv.local_addr()); |