mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 12:46:44 +00:00
add dial bool flag to prevent test nodes from dialing out (maxpeers not enough, cos server dialloop steals first slot for dialing)
This commit is contained in:
parent
38edc428eb
commit
a4c9a99494
4 changed files with 8 additions and 1 deletions
|
|
@ -60,6 +60,7 @@ var (
|
||||||
VmType int
|
VmType int
|
||||||
ImportChain string
|
ImportChain string
|
||||||
SHH bool
|
SHH bool
|
||||||
|
Dial bool
|
||||||
)
|
)
|
||||||
|
|
||||||
// flags specific to cli client
|
// flags specific to cli client
|
||||||
|
|
@ -96,6 +97,7 @@ func Init() {
|
||||||
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)")
|
||||||
flag.BoolVar(&UseSeed, "seed", true, "seed peers")
|
flag.BoolVar(&UseSeed, "seed", true, "seed peers")
|
||||||
flag.BoolVar(&SHH, "shh", true, "whisper protocol (on)")
|
flag.BoolVar(&SHH, "shh", true, "whisper protocol (on)")
|
||||||
|
flag.BoolVar(&Dial, "dial", true, "dial out connections (on)")
|
||||||
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key")
|
||||||
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)")
|
||||||
flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given")
|
flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given")
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ func main() {
|
||||||
PMPGateway: PMPGateway,
|
PMPGateway: PMPGateway,
|
||||||
KeyRing: KeyRing,
|
KeyRing: KeyRing,
|
||||||
Shh: SHH,
|
Shh: SHH,
|
||||||
|
Dial: Dial,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ type Config struct {
|
||||||
PMPGateway string
|
PMPGateway string
|
||||||
|
|
||||||
Shh bool
|
Shh bool
|
||||||
|
Dial bool
|
||||||
|
|
||||||
KeyManager *crypto.KeyManager
|
KeyManager *crypto.KeyManager
|
||||||
}
|
}
|
||||||
|
|
@ -150,6 +151,7 @@ func New(config *Config) (*Ethereum, error) {
|
||||||
Protocols: protocols,
|
Protocols: protocols,
|
||||||
Blacklist: eth.blacklist,
|
Blacklist: eth.blacklist,
|
||||||
NAT: nat,
|
NAT: nat,
|
||||||
|
NoDial: !config.Dial,
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(config.Port) > 0 {
|
if len(config.Port) > 0 {
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,7 @@ func (srv *Server) Start() (err error) {
|
||||||
|
|
||||||
// make all slots available
|
// make all slots available
|
||||||
for i := range srv.peers {
|
for i := range srv.peers {
|
||||||
|
srvlog.Debugf("add slot %v", i)
|
||||||
srv.peerSlots <- i
|
srv.peerSlots <- i
|
||||||
}
|
}
|
||||||
// note: discLoop is not part of WaitGroup
|
// note: discLoop is not part of WaitGroup
|
||||||
|
|
@ -260,6 +261,7 @@ func (srv *Server) listenLoop() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case slot := <-srv.peerSlots:
|
case slot := <-srv.peerSlots:
|
||||||
|
srvlog.Debugf("grabbed slot %v for listening", slot)
|
||||||
conn, err := srv.listener.Accept()
|
conn, err := srv.listener.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
srv.peerSlots <- slot
|
srv.peerSlots <- slot
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue