From 1d253b4d4759e045409fcf140adda7d327a05c8a Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Tue, 18 Dec 2018 12:44:08 -0800 Subject: [PATCH] fix(rt): prevent fallback reactor thread from being created accidentally Switches from `Handle::current()` to `Handle::default()`. --- src/client/connect/http.rs | 2 +- src/server/mod.rs | 2 +- src/server/tcp.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/connect/http.rs b/src/client/connect/http.rs index fecf856c57..c82866621c 100644 --- a/src/client/connect/http.rs +++ b/src/client/connect/http.rs @@ -502,7 +502,7 @@ fn connect(addr: &SocketAddr, local_addr: &Option, handle: &Option Cow::Borrowed(handle), - None => Cow::Owned(Handle::current()), + None => Cow::Owned(Handle::default()), }; Ok(TcpStream::connect_std(builder.to_tcp_stream()?, addr, &handle)) diff --git a/src/server/mod.rs b/src/server/mod.rs index 01cf071349..99a83b8104 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -125,7 +125,7 @@ impl Server { /// Create a new instance from a `std::net::TcpListener` instance. pub fn from_tcp(listener: StdTcpListener) -> Result, ::Error> { - let handle = tokio_reactor::Handle::current(); + let handle = tokio_reactor::Handle::default(); AddrIncoming::from_std(listener, &handle) .map(Server::builder) } diff --git a/src/server/tcp.rs b/src/server/tcp.rs index 4961311eba..efab9619bc 100644 --- a/src/server/tcp.rs +++ b/src/server/tcp.rs @@ -29,7 +29,7 @@ impl AddrIncoming { if let Some(handle) = handle { AddrIncoming::from_std(std_listener, handle) } else { - let handle = Handle::current(); + let handle = Handle::default(); AddrIncoming::from_std(std_listener, &handle) } }