mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
p2p: cleanup v4 if v5 failed
This commit is contained in:
parent
59ea6c3166
commit
4df2a2f859
1 changed files with 5 additions and 0 deletions
|
|
@ -490,6 +490,11 @@ func (srv *Server) setupDiscovery() error {
|
|||
}
|
||||
srv.discv5, err = discover.ListenV5(sconn, srv.localnode, cfg)
|
||||
if err != nil {
|
||||
// Clean up v4 if v5 setup fails.
|
||||
if srv.discv4 != nil {
|
||||
srv.discv4.Close()
|
||||
srv.discv4 = nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue