Skip to content

Commit 842ad6e

Browse files
committed
Sleep changes
1 parent 9c75fc7 commit 842ad6e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/client/connect/http.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use futures_util::future::Either;
1313
use http::uri::{Scheme, Uri};
1414
use pin_project::pin_project;
1515
use tokio::net::TcpStream;
16-
use tokio::time::Delay;
16+
use tokio::time::Sleep;
1717

1818
use super::dns::{self, resolve, GaiResolver, Resolve};
1919
use super::{Connected, Connection};
@@ -510,7 +510,7 @@ impl ConnectingTcp {
510510
local_addr_ipv6,
511511
preferred: ConnectingTcpRemote::new(preferred_addrs, connect_timeout),
512512
fallback: Some(ConnectingTcpFallback {
513-
delay: tokio::time::delay_for(fallback_timeout),
513+
delay: tokio::time::sleep(fallback_timeout),
514514
remote: ConnectingTcpRemote::new(fallback_addrs, connect_timeout),
515515
}),
516516
reuse_address,
@@ -528,7 +528,7 @@ impl ConnectingTcp {
528528
}
529529

530530
struct ConnectingTcpFallback {
531-
delay: Delay,
531+
delay: Sleep,
532532
remote: ConnectingTcpRemote,
533533
}
534534

src/client/pool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ mod tests {
850850
let pooled = pool.pooled(c(key.clone()), Uniq(41));
851851

852852
drop(pooled);
853-
tokio::time::delay_for(pool.locked().timeout.unwrap()).await;
853+
tokio::time::sleep(pool.locked().timeout.unwrap()).await;
854854
let mut checkout = pool.checkout(key);
855855
let poll_once = PollOnce(&mut checkout);
856856
let is_not_ready = poll_once.await.is_none();
@@ -871,7 +871,7 @@ mod tests {
871871
pool.locked().idle.get(&key).map(|entries| entries.len()),
872872
Some(3)
873873
);
874-
tokio::time::delay_for(pool.locked().timeout.unwrap()).await;
874+
tokio::time::sleep(pool.locked().timeout.unwrap()).await;
875875

876876
let mut checkout = pool.checkout(key.clone());
877877
let poll_once = PollOnce(&mut checkout);

src/proto/h2/ping.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use std::time::Instant;
3333

3434
use h2::{Ping, PingPong};
3535
#[cfg(feature = "runtime")]
36-
use tokio::time::{Delay, Instant};
36+
use tokio::time::{Instant, Sleep};
3737

3838
type WindowSize = u32;
3939

@@ -60,7 +60,7 @@ pub(super) fn channel(ping_pong: PingPong, config: Config) -> (Recorder, Ponger)
6060
interval,
6161
timeout: config.keep_alive_timeout,
6262
while_idle: config.keep_alive_while_idle,
63-
timer: tokio::time::delay_for(interval),
63+
timer: tokio::time::sleep(interval),
6464
state: KeepAliveState::Init,
6565
});
6666

@@ -156,7 +156,7 @@ struct KeepAlive {
156156
while_idle: bool,
157157

158158
state: KeepAliveState,
159-
timer: Delay,
159+
timer: Sleep,
160160
}
161161

162162
#[cfg(feature = "runtime")]

src/server/tcp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::net::{SocketAddr, TcpListener as StdTcpListener};
44
use std::time::Duration;
55

66
use tokio::net::TcpListener;
7-
use tokio::time::Delay;
7+
use tokio::time::Sleep;
88

99
use crate::common::{task, Future, Pin, Poll};
1010

@@ -19,7 +19,7 @@ pub struct AddrIncoming {
1919
sleep_on_errors: bool,
2020
tcp_keepalive_timeout: Option<Duration>,
2121
tcp_nodelay: bool,
22-
timeout: Option<Delay>,
22+
timeout: Option<Sleep>,
2323
}
2424

2525
impl AddrIncoming {
@@ -119,7 +119,7 @@ impl AddrIncoming {
119119
error!("accept error: {}", e);
120120

121121
// Sleep 1s.
122-
let mut timeout = tokio::time::delay_for(Duration::from_secs(1));
122+
let mut timeout = tokio::time::sleep(Duration::from_secs(1));
123123

124124
match Pin::new(&mut timeout).poll(cx) {
125125
Poll::Ready(()) => {

0 commit comments

Comments
 (0)