fn on_peer_disconnected(&mut self, peer: PeerId, debug_info: String) {
		trace!(target: "sync", "Disconnecting {}: {}", peer, debug_info);
		// lock all the the peer lists so that add/remove peer events are in order
		let removed = {
			self.handshaking_peers.remove(&peer);
			self.connected_peers.write().remove(&peer);
			self.context_data.peers.remove(&peer).is_some()
		};
		if removed {
			let mut context = ProtocolContext::new(&mut self.context_data, &self.network_chan);
			self.consensus_gossip.peer_disconnected(&mut context, peer.clone());
			self.sync.peer_disconnected(&mut context, peer.clone());
			self.specialization.on_disconnect(&mut context, peer.clone());
			self.on_demand.as_ref().map(|s| s.on_disconnect(peer));
		}
	}
/// Called by peer when it is disconnecting
Called by peer when it is disconnecting
Called by peer when it is disconnecting
fn on_peer_disconnected(&mut self, peer: PeerId, debug_info: String) {
		trace!(target: "sync", "Disconnecting {}: {}", peer, debug_info);
		// lock all the the peer lists so that add/remove peer events are in order
		let removed = {
			self.handshaking_peers.remove(&peer);
			self.connected_peers.write().remove(&peer);
			self.context_data.peers.remove(&peer).is_some()
		};
		if removed {
			let mut context = ProtocolContext::new(&mut self.context_data, &self.network_chan);
			self.consensus_gossip.peer_disconnected(&mut context, peer.clone());
			self.sync.peer_disconnected(&mut context, peer.clone());
			self.specialization.on_disconnect(&mut context, peer.clone());
			self.on_demand.as_ref().map(|s| s.on_disconnect(peer));
		}
	}
fn on_peer_disconnected ( & mut self , peer : PeerId , debug_info : String ) { trace ! ( target " " " " peer debug_info ) ; // lock all the the peer lists so that add/remove peer events are in order let removed = { self . handshaking_peers . remove ( & peer ) ; self . connected_peers . write ( ) . remove ( & peer ) ; self . context_data . peers . remove ( & peer ) . is_some ( ) } ; if removed { let mut context = ProtocolContext :: new ( & mut self . context_data , & self . network_chan ) ; self . consensus_gossip . peer_disconnected ( & mut context , peer . clone ( ) ) ; self . sync . peer_disconnected ( & mut context , peer . clone ( ) ) ; self . specialization . on_disconnect ( & mut context , peer . clone ( ) ) ; self . on_demand . as_ref ( ) . map ( | s | s . on_disconnect ( peer ) ) ; } }
Called by peer when it is disconnecting
Called by peer when it is disconnecting
&mut self
peer
PeerId
debug_info
String
&mut self
peer
PeerId
debug_info
String