feat(lib): Upgrade to Tokio 1.0 (#2369)

Closes #2370
This commit is contained in:
Sean McArthur
2020-12-23 10:36:12 -08:00
committed by GitHub
parent dad5c8792f
commit fad42acc79
14 changed files with 71 additions and 146 deletions

View File

@@ -19,7 +19,7 @@ pub struct AddrIncoming {
sleep_on_errors: bool,
tcp_keepalive_timeout: Option<Duration>,
tcp_nodelay: bool,
timeout: Option<Sleep>,
timeout: Option<Pin<Box<Sleep>>>,
}
impl AddrIncoming {
@@ -160,9 +160,9 @@ impl AddrIncoming {
error!("accept error: {}", e);
// Sleep 1s.
let mut timeout = tokio::time::sleep(Duration::from_secs(1));
let mut timeout = Box::pin(tokio::time::sleep(Duration::from_secs(1)));
match Pin::new(&mut timeout).poll(cx) {
match timeout.as_mut().poll(cx) {
Poll::Ready(()) => {
// Wow, it's been a second already? Ok then...
continue;
@@ -263,7 +263,7 @@ mod addr_stream {
pub fn poll_peek(
&mut self,
cx: &mut task::Context<'_>,
buf: &mut [u8],
buf: &mut tokio::io::ReadBuf<'_>,
) -> Poll<io::Result<usize>> {
self.inner.poll_peek(cx, buf)
}