Bug fix for loop on message receive & other fixes

This commit is contained in:
Lyndsay Roger 2015-08-18 20:24:51 +12:00
parent a2ef24a926
commit 0330c53fa1
3 changed files with 12 additions and 8 deletions

View File

@ -14,6 +14,11 @@ import (
// list of currently active addresses
func crawlTwistee(tw *Twistee) {
tw.crawlActive = true
tw.crawlStart = time.Now()
defer crawlEnd(tw)
if config.debug {
log.Printf("status - start crawl: twistee %s status: %v:%v lastcrawl: %s\n",
net.JoinHostPort(tw.na.IP.String(),
@ -23,11 +28,6 @@ func crawlTwistee(tw *Twistee) {
time.Since(tw.crawlStart).String())
}
tw.crawlActive = true
tw.crawlStart = time.Now()
defer crawlEnd(tw)
// connect to the remote ip and ask them for their addr list
ras, err := crawlIP(tw)
if err != nil {
@ -202,6 +202,7 @@ func crawlIP(tw *Twistee) ([]*wire.NetAddress, error) {
return nil, err
}
c := 0
dowhile := true
for dowhile == true {
@ -224,10 +225,14 @@ func crawlIP(tw *Twistee) ([]*wire.NetAddress, error) {
}
}
}
// if we get more than 25 messages before the addr we asked for then give up on this client
if c++; c >= 25 {
dowhile = false
}
}
// should never get here but need a return command
return nil, nil
return nil, errors.New("FIXME - something went wrong and did not get an Addr response")
}
/*

View File

@ -150,7 +150,6 @@ func (s *Seeder) startCrawlers() {
}
// all looks go so start a go routine to crawl the remote twistee
tw.crawlActive = true
go crawlTwistee(tw)
c.started++
}

View File

@ -40,7 +40,7 @@ func updateDNS(s *Seeder) {
for _, tw := range s.theList {
// when we reach max exit
if numRR >= 15 {
if numRR >= 25 {
break
}