Add an error associated type to ProtocolsHandler (#795)

This commit is contained in:
Pierre Krieger
2018-12-28 15:11:35 +01:00
committed by GitHub
parent d10cafa804
commit 7798e23e78
13 changed files with 36 additions and 27 deletions

View File

@ -29,7 +29,7 @@ use crate::{
}
};
use futures::prelude::*;
use std::{io, time::Duration};
use std::time::Duration;
use tokio_timer::Timeout;
/// Prototype for a `NodeHandlerWrapper`.
@ -123,7 +123,7 @@ where
{
type InEvent = TProtoHandler::InEvent;
type OutEvent = TProtoHandler::OutEvent;
type Error = io::Error; // TODO: better error type
type Error = TProtoHandler::Error;
type Substream = TProtoHandler::Substream;
// The first element of the tuple is the unique upgrade identifier
// (see `unique_dial_upgrade_id`).
@ -198,7 +198,7 @@ where
self.handler.shutdown();
}
fn poll(&mut self) -> Poll<Option<NodeHandlerEvent<Self::OutboundOpenInfo, Self::OutEvent>>, io::Error> {
fn poll(&mut self) -> Poll<Option<NodeHandlerEvent<Self::OutboundOpenInfo, Self::OutEvent>>, Self::Error> {
// Continue negotiation of newly-opened substreams on the listening side.
// We remove each element from `negotiating_in` one by one and add them back if not ready.
for n in (0..self.negotiating_in.len()).rev() {