Browse Source

fixed #11

pull/39/head
Jae Kwon 10 years ago
parent
commit
44a60a89c6
2 changed files with 5 additions and 2 deletions
  1. +3
    -1
      cmd/daemon.go
  2. +2
    -1
      p2p/pex_reactor.go

+ 3
- 1
cmd/daemon.go View File

@ -132,13 +132,15 @@ func daemon() {
// If seedNode is provided by config, dial out.
if config.App.GetString("SeedNode") != "" {
peer, err := n.sw.DialPeerWithAddress(p2p.NewNetAddressString(config.App.GetString("SeedNode")))
addr := p2p.NewNetAddressString(config.App.GetString("SeedNode"))
peer, err := n.sw.DialPeerWithAddress(addr)
if err != nil {
log.Error("Error dialing seed", "error", err)
//n.book.MarkAttempt(addr)
return
} else {
log.Info("Connected to seed", "peer", peer)
n.book.AddAddress(addr, addr)
}
}


+ 2
- 1
p2p/pex_reactor.go View File

@ -152,6 +152,7 @@ FOR_LOOP:
func (pexR *PEXReactor) ensurePeers() {
numOutPeers, _, numDialing := pexR.sw.NumPeers()
numToDial := minNumOutboundPeers - (numOutPeers + numDialing)
log.Info("Ensure peers", "numOutPeers", numOutPeers, "numDialing", numDialing, "numToDial", numToDial)
if numToDial <= 0 {
return
}
@ -164,7 +165,7 @@ func (pexR *PEXReactor) ensurePeers() {
var picked *NetAddress
// Try to fetch a new peer 3 times.
// This caps the maximum number of tries to 3 * numToDial.
for j := 0; i < 3; j++ {
for j := 0; j < 3; j++ {
picked = pexR.book.PickAddress(newBias)
if picked == nil {
return


Loading…
Cancel
Save