mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 05:06:43 +00:00
p2p: maxpeers -1 disables the network, maxpeers 0 allowed and means 0 dynamic peers
This commit is contained in:
parent
b06226678e
commit
97ab1abc1b
2 changed files with 2 additions and 2 deletions
|
|
@ -476,7 +476,7 @@ func (s *Ethereum) Start() error {
|
||||||
ProtocolVersion: ProtocolVersion,
|
ProtocolVersion: ProtocolVersion,
|
||||||
})
|
})
|
||||||
|
|
||||||
if s.net.MaxPeers > 0 {
|
if s.net.MaxPeers >= 0 {
|
||||||
err := s.net.Start()
|
err := s.net.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ func (srv *Server) Start() (err error) {
|
||||||
if srv.PrivateKey == nil {
|
if srv.PrivateKey == nil {
|
||||||
return fmt.Errorf("Server.PrivateKey must be set to a non-nil key")
|
return fmt.Errorf("Server.PrivateKey must be set to a non-nil key")
|
||||||
}
|
}
|
||||||
if srv.MaxPeers <= 0 {
|
if srv.MaxPeers < 0 {
|
||||||
return fmt.Errorf("Server.MaxPeers must be > 0")
|
return fmt.Errorf("Server.MaxPeers must be > 0")
|
||||||
}
|
}
|
||||||
srv.quit = make(chan struct{})
|
srv.quit = make(chan struct{})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue