mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-24 07:11:38 +00:00
Switch to stable futures (#1196)
* Switch to stable futures * Remove from_fn * Fix secio * Fix core --lib tests
This commit is contained in:
@ -35,7 +35,7 @@ use rand;
|
||||
use smallvec::SmallVec;
|
||||
use std::{collections::VecDeque, iter, marker::PhantomData};
|
||||
use std::collections::hash_map::{DefaultHasher, HashMap};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use std::task::{Context, Poll};
|
||||
|
||||
/// Network behaviour that automatically identifies nodes periodically, and returns information
|
||||
/// about them.
|
||||
@ -230,7 +230,7 @@ impl<TSubstream> Floodsub<TSubstream> {
|
||||
|
||||
impl<TSubstream> NetworkBehaviour for Floodsub<TSubstream>
|
||||
where
|
||||
TSubstream: AsyncRead + AsyncWrite,
|
||||
TSubstream: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
type ProtocolsHandler = OneShotHandler<TSubstream, FloodsubConfig, FloodsubRpc, InnerMessage>;
|
||||
type OutEvent = FloodsubEvent;
|
||||
@ -359,18 +359,19 @@ where
|
||||
|
||||
fn poll(
|
||||
&mut self,
|
||||
_: &mut Context,
|
||||
_: &mut impl PollParameters,
|
||||
) -> Async<
|
||||
) -> Poll<
|
||||
NetworkBehaviourAction<
|
||||
<Self::ProtocolsHandler as ProtocolsHandler>::InEvent,
|
||||
Self::OutEvent,
|
||||
>,
|
||||
> {
|
||||
if let Some(event) = self.events.pop_front() {
|
||||
return Async::Ready(event);
|
||||
return Poll::Ready(event);
|
||||
}
|
||||
|
||||
Async::NotReady
|
||||
Poll::Pending
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@
|
||||
|
||||
use crate::rpc_proto;
|
||||
use crate::topic::TopicHash;
|
||||
use futures::prelude::*;
|
||||
use libp2p_core::{InboundUpgrade, OutboundUpgrade, UpgradeInfo, PeerId, upgrade};
|
||||
use protobuf::{ProtobufError, Message as ProtobufMessage};
|
||||
use std::{error, fmt, io, iter};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
|
||||
/// Implementation of `ConnectionUpgrade` for the floodsub protocol.
|
||||
#[derive(Debug, Clone, Default)]
|
||||
@ -49,7 +49,7 @@ impl UpgradeInfo for FloodsubConfig {
|
||||
|
||||
impl<TSocket> InboundUpgrade<TSocket> for FloodsubConfig
|
||||
where
|
||||
TSocket: AsyncRead + AsyncWrite,
|
||||
TSocket: AsyncRead + AsyncWrite + Unpin,
|
||||
{
|
||||
type Output = FloodsubRpc;
|
||||
type Error = FloodsubDecodeError;
|
||||
@ -164,7 +164,7 @@ impl UpgradeInfo for FloodsubRpc {
|
||||
|
||||
impl<TSocket> OutboundUpgrade<TSocket> for FloodsubRpc
|
||||
where
|
||||
TSocket: AsyncWrite + AsyncRead,
|
||||
TSocket: AsyncWrite + AsyncRead + Unpin,
|
||||
{
|
||||
type Output = ();
|
||||
type Error = io::Error;
|
||||
|
Reference in New Issue
Block a user