Browse Source

Add SetDeadline on comms to remote twistees

master
Lyndsay Roger 9 years ago
parent
commit
905796b6ae
  1. 3
      crawler.go
  2. 4
      dnsseeder.go

3
crawler.go

@ -140,6 +140,9 @@ func crawlIP(tw *Twistee) ([]*wire.NetAddress, *CrawlError) {
log.Printf("%s - Connected to remote address. Last connect was %v ago\n", ip, time.Since(tw.lastConnect).String()) log.Printf("%s - Connected to remote address. Last connect was %v ago\n", ip, time.Since(tw.lastConnect).String())
} }
// set a deadline for all comms to be done by. After this all i/o will error
conn.SetDeadline(time.Now().Add(time.Second * MAXTO))
// First command to remote end needs to be a version command // First command to remote end needs to be a version command
// last parameter is lastblock // last parameter is lastblock
msgver, err := wire.NewMsgVersionFromConn(conn, NOUNCE, 0) msgver, err := wire.NewMsgVersionFromConn(conn, NOUNCE, 0)

4
dnsseeder.go

@ -23,7 +23,9 @@ const (
TWSTDPORT = 28333 // standard port twister listens on TWSTDPORT = 28333 // standard port twister listens on
MAXFAILS = 55 // max number of connect fails before we delete a twistee. Just over 24 hours(checked every 33 minutes) MAXFAILS = 48 // max number of connect fails before we delete a twistee. Just over 24 hours(checked every 33 minutes)
MAXTO = 250 // max seconds (4min 10 sec) for all comms to twistee to complete before we timeout
// DNS Type. Is this twistee using v4/v6 and standard or non standard ports // DNS Type. Is this twistee using v4/v6 and standard or non standard ports
DNSV4STD = 1 DNSV4STD = 1

Loading…
Cancel
Save