mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
p2p/peer : defer wait group done in protocol start
This commit is contained in:
parent
79b68dd78d
commit
4d1f72a415
1 changed files with 1 additions and 1 deletions
|
|
@ -365,6 +365,7 @@ func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error)
|
|||
}
|
||||
p.log.Trace(fmt.Sprintf("Starting protocol %s/%d", proto.Name, proto.Version))
|
||||
go func() {
|
||||
defer p.wg.Done()
|
||||
err := proto.Run(p, rw)
|
||||
if err == nil {
|
||||
p.log.Trace(fmt.Sprintf("Protocol %s/%d returned", proto.Name, proto.Version))
|
||||
|
|
@ -373,7 +374,6 @@ func (p *Peer) startProtocols(writeStart <-chan struct{}, writeErr chan<- error)
|
|||
p.log.Trace(fmt.Sprintf("Protocol %s/%d failed", proto.Name, proto.Version), "err", err)
|
||||
}
|
||||
p.protoErr <- err
|
||||
p.wg.Done()
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue