Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fix warnings in networking #652

Merged
merged 1 commit into from
Sep 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions substrate/network-libp2p/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use futures::{future, Future, stream, Stream};
use futures::sync::{mpsc, oneshot};
use tokio::runtime::current_thread;
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_timer::{Interval, Deadline};
use tokio_timer::{Interval, Timeout};

use custom_proto::{RegisteredProtocol, RegisteredProtocols};
use custom_proto::RegisteredProtocolOutput;
Expand Down Expand Up @@ -689,9 +689,8 @@ fn handle_kademlia_connection(
let next = kademlia_stream
.into_future()
.map_err(|(err, _)| err);
let deadline = Instant::now() + Duration::from_secs(20);

Deadline::new(next, deadline)
Timeout::new(next, Duration::from_secs(20))
.map_err(|err|
// TODO: improve the error reporting here, but tokio-timer's API is bad
IoError::new(IoErrorKind::Other, err)
Expand Down Expand Up @@ -1243,7 +1242,7 @@ fn periodic_updates<Tp, Tid, St, C>(
.map_err(|err| IoError::new(IoErrorKind::Other, err))
});
let ping_start_time = Instant::now();
let fut = Deadline::new(fut, ping_start_time + Duration::from_secs(30))
let fut = Timeout::new_at(fut, ping_start_time + Duration::from_secs(30))
.then(move |val|
match val {
Err(err) => {
Expand Down