diff --git a/ethcore/light/src/net/mod.rs b/ethcore/light/src/net/mod.rs index 24f50e5d5..5af921d80 100644 --- a/ethcore/light/src/net/mod.rs +++ b/ethcore/light/src/net/mod.rs @@ -821,12 +821,15 @@ impl LightProtocol { })); let any_kept = self.handlers.iter().map( - |handler| - handler.on_connect(&Ctx { - peer: *peer, - io: io, - proto: self, - }, &status, &capabilities) + |handler| handler.on_connect( + &Ctx { + peer: *peer, + io: io, + proto: self, + }, + &status, + &capabilities + ) ).fold(PeerStatus::Kept, PeerStatus::bitor); if any_kept == PeerStatus::Unkept { diff --git a/ethcore/light/src/on_demand/mod.rs b/ethcore/light/src/on_demand/mod.rs index 8306f3a1a..c1919ebd1 100644 --- a/ethcore/light/src/on_demand/mod.rs +++ b/ethcore/light/src/on_demand/mod.rs @@ -30,15 +30,8 @@ use network::PeerId; use util::{RwLock, Mutex}; use net::{ - self, - Handler, - PeerStatus, - Status, - Capabilities, - Announcement, - EventContext, - BasicContext, - ReqId, + self, Handler, PeerStatus, Status, Capabilities, + Announcement, EventContext, BasicContext, ReqId, }; use cache::Cache; use request::{self as basic_request, Request as NetworkRequest}; diff --git a/sync/src/light_sync/mod.rs b/sync/src/light_sync/mod.rs index 558e28ecd..512ba7943 100644 --- a/sync/src/light_sync/mod.rs +++ b/sync/src/light_sync/mod.rs @@ -236,6 +236,8 @@ impl Handler for LightSync { status: &Status, capabilities: &Capabilities ) -> PeerStatus { + use std::cmp; + if capabilities.serve_headers { let chain_info = ChainInfo { head_td: status.head_td, @@ -245,7 +247,7 @@ impl Handler for LightSync { { let mut best = self.best_seen.lock(); - *best = ::std::cmp::max(best.clone(), Some(chain_info.clone())); + *best = cmp::max(best.clone(), Some(chain_info.clone())); } self.peers.write().insert(ctx.peer(), Mutex::new(Peer::new(chain_info))); @@ -253,9 +255,6 @@ impl Handler for LightSync { PeerStatus::Kept } else { - trace!(target: "sync", "Disconnecting irrelevant peer: {}", ctx.peer()); - ctx.disconnect_peer(ctx.peer()); - PeerStatus::Unkept } }