aboutsummaryrefslogtreecommitdiffstats
path: root/eth/handler.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-26 19:00:21 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-05-26 19:00:21 +0800
commiteafdc1f8e371fd698da33491a01799393249729a (patch)
treee834b1921a15767edf889d3bd2b9f9713c1101ed /eth/handler.go
parentcc318ff8db20528cb567227c42c5d37dc892cc49 (diff)
downloadgo-tangerine-eafdc1f8e371fd698da33491a01799393249729a.tar.gz
go-tangerine-eafdc1f8e371fd698da33491a01799393249729a.tar.zst
go-tangerine-eafdc1f8e371fd698da33491a01799393249729a.zip
eth, eth/downloader: surface downloaded block origin, drop on error
Diffstat (limited to 'eth/handler.go')
-rw-r--r--eth/handler.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 9117a70de..777a9c7c0 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -92,13 +92,13 @@ func NewProtocolManager(protocolVersion, networkId int, mux *event.TypeMux, txpo
return manager
}
-func (pm *ProtocolManager) removePeer(peer *peer) {
+func (pm *ProtocolManager) removePeer(id string) {
// Unregister the peer from the downloader
- pm.downloader.UnregisterPeer(peer.id)
+ pm.downloader.UnregisterPeer(id)
// Remove the peer from the Ethereum peer set too
- glog.V(logger.Detail).Infoln("Removing peer", peer.id)
- if err := pm.peers.Unregister(peer.id); err != nil {
+ glog.V(logger.Detail).Infoln("Removing peer", id)
+ if err := pm.peers.Unregister(id); err != nil {
glog.V(logger.Error).Infoln("Removal failed:", err)
}
}
@@ -148,7 +148,7 @@ func (pm *ProtocolManager) handle(p *peer) error {
glog.V(logger.Error).Infoln("Addition failed:", err)
return err
}
- defer pm.removePeer(p)
+ defer pm.removePeer(p.id)
if err := pm.downloader.RegisterPeer(p.id, p.recentHash, p.requestHashes, p.requestBlocks); err != nil {
return err
@@ -315,7 +315,7 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
if _, err := self.chainman.InsertChain(types.Blocks{request.Block}); err != nil {
glog.V(logger.Error).Infoln("removed peer (", p.id, ") due to block error")
- self.removePeer(p)
+ self.removePeer(p.id)
return nil
}