mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 04:36:42 +00:00
eth: fix race conditions and add safety checks
This commit is contained in:
parent
8bd797b6c6
commit
932f5067c9
1 changed files with 4 additions and 1 deletions
|
|
@ -319,7 +319,10 @@ func (h *handler) runEthPeer(peer *eth.Peer, handler eth.Handler) error {
|
|||
// Capture peer ID and logger to avoid race conditions in goroutines
|
||||
peerID := peer.ID()
|
||||
peerLogger := peer.Log()
|
||||
peerAddr := peer.RemoteAddr()
|
||||
peerAddr := ""
|
||||
if addr := peer.RemoteAddr(); addr != nil {
|
||||
peerAddr = addr.String()
|
||||
}
|
||||
peerName := peer.Name()
|
||||
for number, hash := range h.requiredBlocks {
|
||||
resCh := make(chan *eth.Response)
|
||||
|
|
|
|||
Loading…
Reference in a new issue