Skip to content

Commit a382821

Browse files
committed
simulator: don't treat dial errors as errors
Leads to too many superfluous io-timeout messages.
1 parent 66c7320 commit a382821

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

simulator/miner.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ func (s *StratumMiner) Simulate(ctx context.Context, dst string) error {
4444
conn.Close()
4545
}
4646

47-
if isSoftError(err, "connect: connection refused") {
47+
// TODO Dropping isDialError() as an error as it's causing too many io-timeout messages.
48+
if isSoftError(err, "connect: connection refused") || isDialError(err) {
4849
return nil
4950
}
5051
return err

simulator/simulator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ func (s *TCPConnectSimulator) Simulate(ctx context.Context, dst string) error {
7272
if conn != nil {
7373
conn.Close()
7474
}
75-
// This will likely generate some superfluous io-timeout error messages, but if the
76-
// user specifies a misconfigured interface, they'll see the simulation failing.
77-
if err != nil && (!isSoftError(err, "connect: connection refused") || isDialError(err)) {
75+
// TODO: Dropping isDialError() check, as it's causing too many io-timeout messages.
76+
if err != nil && !isSoftError(err, "connect: connection refused") && !isDialError(err) {
7877
return err
7978
}
8079
return nil
@@ -112,7 +111,8 @@ func (s *DNSResolveSimulator) Simulate(ctx context.Context, dst string) error {
112111

113112
_, err := r.LookupHost(ctx, host)
114113
// Ignore "no such host". Will ignore timeouts as well, so check for dial errors.
115-
if err != nil && (!isSoftError(err, "no such host") || isDialError(err)) {
114+
// TODO: Dropping isDialError() check, as it's causing too many io-timeout messages.
115+
if err != nil && !isSoftError(err, "no such host") && !isDialError(err) {
116116
return err
117117
}
118118

simulator/spambot.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,11 @@ func (s *Spambot) Hosts(scope string, size int) ([]string, error) {
8989
for n := 0; len(hosts) < size && n < len(idx); n++ {
9090
ctx, cancel := context.WithTimeout(context.Background(), 300*time.Millisecond)
9191
host := utils.FQDN(domains[idx[n]])
92-
mx, err := rv.LookupMX(ctx, host)
92+
mx, _ := rv.LookupMX(ctx, host)
9393
cancel()
9494
// Check error message for sign of resolver/routing issue.
95-
if err != nil && isDialError(err) {
96-
return hosts, err
97-
}
95+
// TODO: at some point we'll want to check dialer errors for a sign of resolver
96+
// problems
9897
if len(mx) > 0 {
9998
host := strings.TrimSuffix(mx[0].Host, ".")
10099
if !seen[host] {

simulator/tunnel-dns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (s *Tunnel) Simulate(ctx context.Context, host string) error {
5757
_, err := r.LookupTXT(ctx, fmt.Sprintf("%s.%s", label, host))
5858

5959
// Ignore "no such host". Will ignore timeouts as well, so check for dial errors.
60-
if err != nil && (!isSoftError(err, "no such host") || isDialError(err)) {
60+
if err != nil && !isSoftError(err, "no such host") && !isDialError(err) {
6161
return err
6262
}
6363

0 commit comments

Comments
 (0)