diff --git a/beacon_node/eth2-libp2p/src/behaviour.rs b/beacon_node/eth2-libp2p/src/behaviour.rs index 0d704c6f14..ef5db8008e 100644 --- a/beacon_node/eth2-libp2p/src/behaviour.rs +++ b/beacon_node/eth2-libp2p/src/behaviour.rs @@ -4,19 +4,20 @@ use crate::rpc::*; use crate::types::{GossipEncoding, GossipKind, GossipTopic}; use crate::{error, Enr, NetworkConfig, NetworkGlobals, PubsubMessage, TopicHash}; use discv5::Discv5Event; -use futures::prelude::*; use libp2p::{ core::{identity::Keypair, ConnectedPoint}, gossipsub::{Gossipsub, GossipsubEvent, MessageId}, identify::{Identify, IdentifyEvent}, - swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess}, + swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess, PollParameters}, NetworkBehaviour, PeerId, }; use lru::LruCache; use slog::{crit, debug, o, warn}; -use std::marker::PhantomData; -use std::sync::Arc; -use std::task::Poll; +use std::{ + marker::PhantomData, + sync::Arc, + task::{Context, Poll}, +}; use types::{EnrForkId, EthSpec, SubnetId}; const MAX_IDENTIFY_ADDRESSES: usize = 10; @@ -461,11 +462,13 @@ impl Behaviour { /// Consumes the events list when polled. fn poll( &mut self, + cx: &mut Context, + _: &mut impl PollParameters, ) -> Poll>> { // check the peer manager for events loop { - match self.peer_manager.poll() { - Ok(Poll::Ready(Some(event))) => match event { + match self.peer_manager.poll_next_unpin(cx) { + Poll::Ready(Some(event))) => match event { PeerManagerEvent::Status(peer_id) => { // it's time to status. We don't keep a beacon chain reference here, so we inform // the network to send a status to this peer @@ -488,9 +491,7 @@ impl Behaviour { } }, Poll::Pending => break, - Poll::Ready(None) | Err(_) => { - crit!(self.log, "Error polling peer manager"); - break; + Poll::Ready(None) => break, // peer manager ended } } }