Browse Source

statesync: do not recover panic on peer updates (#5869)

pull/5871/head
Aleksandr Bezobchuk 4 years ago
committed by GitHub
parent
commit
8bf77d9b1a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 11 deletions
  1. +2
    -11
      statesync/reactor.go

+ 2
- 11
statesync/reactor.go View File

@ -392,14 +392,7 @@ func (r *Reactor) processChunkCh() {
// processPeerUpdate processes a PeerUpdate, returning an error upon failing to
// handle the PeerUpdate or if a panic is recovered.
func (r *Reactor) processPeerUpdate(peerUpdate p2p.PeerUpdate) (err error) {
defer func() {
if e := recover(); e != nil {
err = fmt.Errorf("panic in processing peer update: %v", e)
r.Logger.Error("recovering from processing peer update panic", "err", err)
}
}()
func (r *Reactor) processPeerUpdate(peerUpdate p2p.PeerUpdate) {
r.Logger.Debug("received peer update", "peer", peerUpdate.PeerID, "status", peerUpdate.Status)
r.mtx.RLock()
@ -414,8 +407,6 @@ func (r *Reactor) processPeerUpdate(peerUpdate p2p.PeerUpdate) (err error) {
r.syncer.RemovePeer(peerUpdate.PeerID)
}
}
return err
}
// processPeerUpdates initiates a blocking process where we listen for and handle
@ -427,7 +418,7 @@ func (r *Reactor) processPeerUpdates() {
for {
select {
case peerUpdate := <-r.peerUpdates.Updates():
_ = r.processPeerUpdate(peerUpdate)
r.processPeerUpdate(peerUpdate)
case <-r.closeCh:
r.Logger.Debug("stopped listening on peer updates channel; closing...")


Loading…
Cancel
Save