Skip to content

Commit

Permalink
fix(rt): prevent fallback reactor thread from being created accidentally
Browse files Browse the repository at this point in the history
Switches from `Handle::current()` to `Handle::default()`.
  • Loading branch information
seanmonstar committed Dec 18, 2018
1 parent ce56ffb commit 1d253b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/connect/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ fn connect(addr: &SocketAddr, local_addr: &Option<IpAddr>, handle: &Option<Handl

let handle = match *handle {
Some(ref handle) => Cow::Borrowed(handle),
None => Cow::Owned(Handle::current()),
None => Cow::Owned(Handle::default()),
};

Ok(TcpStream::connect_std(builder.to_tcp_stream()?, addr, &handle))
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl Server<AddrIncoming, ()> {

/// Create a new instance from a `std::net::TcpListener` instance.
pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, ::Error> {
let handle = tokio_reactor::Handle::current();
let handle = tokio_reactor::Handle::default();
AddrIncoming::from_std(listener, &handle)
.map(Server::builder)
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 1d253b4

Please sign in to comment.