mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 21:26:42 +00:00
if port is empty string, no listening
This commit is contained in:
parent
4757aa0c2e
commit
d82df7e30f
1 changed files with 9 additions and 6 deletions
|
|
@ -142,12 +142,15 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
eth.net = &p2p.Server{
|
eth.net = &p2p.Server{
|
||||||
Identity: clientId,
|
Identity: clientId,
|
||||||
MaxPeers: config.MaxPeers,
|
MaxPeers: config.MaxPeers,
|
||||||
Protocols: protocols,
|
Protocols: protocols,
|
||||||
ListenAddr: ":" + config.Port,
|
Blacklist: eth.blacklist,
|
||||||
Blacklist: eth.blacklist,
|
NAT: nat,
|
||||||
NAT: nat,
|
}
|
||||||
|
|
||||||
|
if len(config.Port) > 0 {
|
||||||
|
eth.net.ListenAddr = ":" + config.Port
|
||||||
}
|
}
|
||||||
|
|
||||||
return eth, nil
|
return eth, nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue