Skip to content

Commit 1d253b4

Browse files
committed
fix(rt): prevent fallback reactor thread from being created accidentally
Switches from `Handle::current()` to `Handle::default()`.
1 parent ce56ffb commit 1d253b4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Diff for: src/client/connect/http.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ fn connect(addr: &SocketAddr, local_addr: &Option<IpAddr>, handle: &Option<Handl
502502

503503
let handle = match *handle {
504504
Some(ref handle) => Cow::Borrowed(handle),
505-
None => Cow::Owned(Handle::current()),
505+
None => Cow::Owned(Handle::default()),
506506
};
507507

508508
Ok(TcpStream::connect_std(builder.to_tcp_stream()?, addr, &handle))

Diff for: src/server/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl Server<AddrIncoming, ()> {
125125

126126
/// Create a new instance from a `std::net::TcpListener` instance.
127127
pub fn from_tcp(listener: StdTcpListener) -> Result<Builder<AddrIncoming>, ::Error> {
128-
let handle = tokio_reactor::Handle::current();
128+
let handle = tokio_reactor::Handle::default();
129129
AddrIncoming::from_std(listener, &handle)
130130
.map(Server::builder)
131131
}

Diff for: src/server/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl AddrIncoming {
2929
if let Some(handle) = handle {
3030
AddrIncoming::from_std(std_listener, handle)
3131
} else {
32-
let handle = Handle::current();
32+
let handle = Handle::default();
3333
AddrIncoming::from_std(std_listener, &handle)
3434
}
3535
}

0 commit comments

Comments
 (0)