From 905796b6aeae7564ce27f8b0d9532291726e397e Mon Sep 17 00:00:00 2001 From: Lyndsay Roger Date: Wed, 19 Aug 2015 19:03:54 +1200 Subject: [PATCH] Add SetDeadline on comms to remote twistees --- crawler.go | 3 +++ dnsseeder.go | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/crawler.go b/crawler.go index 7abc3ad..d7a8154 100644 --- a/crawler.go +++ b/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()) } + // 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 // last parameter is lastblock msgver, err := wire.NewMsgVersionFromConn(conn, NOUNCE, 0) diff --git a/dnsseeder.go b/dnsseeder.go index 0e6d73a..6267c1e 100644 --- a/dnsseeder.go +++ b/dnsseeder.go @@ -23,7 +23,9 @@ const ( 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 DNSV4STD = 1