(id string)
| 158 | } |
| 159 | |
| 160 | func (pm *ProtocolManager) removePeer(id string) { |
| 161 | // Short circuit if the peer was already removed |
| 162 | peer := pm.peers.Peer(id) |
| 163 | if peer == nil { |
| 164 | return |
| 165 | } |
| 166 | log.Debug("Removing cpchain peer", "peer", id) |
| 167 | |
| 168 | if err := pm.peers.Unregister(id); err != nil { |
| 169 | log.Error("Peer removal failed", "peer", id, "err", err) |
| 170 | } |
| 171 | // Hard disconnect at the networking layer |
| 172 | if peer != nil { |
| 173 | peer.Peer.Disconnect(p2p.DiscUselessPeer) |
| 174 | } |
| 175 | pm.syncer.RemovePeer(peer.IDString()) |
| 176 | } |
| 177 | |
| 178 | // Start starts all the blockchain synchronization mechanisms |
| 179 | func (pm *ProtocolManager) Start(maxPeers int) { |
no test coverage detected