Skip to content

Commit

Permalink
Fix intelligent detect logic @Release
Browse files Browse the repository at this point in the history
  • Loading branch information
wweir committed Jan 23, 2019
1 parent c9191ec commit 41a1adc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package dns

import (
"errors"
"io"
"net"
"strings"
"time"
Expand Down Expand Up @@ -102,7 +101,11 @@ func (i *intelliSuggest) GetOne(domain interface{}) (ret interface{}, err error)
glog.V(1).Infoln("dial self service fail:", err)
return
}
if _, err = conn.Read(make([]byte, 1)); err == io.EOF {

// err -> nil: read something succ
// err -> io.EOF: no such domain or connection refused
// err -> timeout: tcp package has been dropped
if _, err = conn.Read(make([]byte, 1)); err != nil {
if idx+1 == len(i.ports) {
return ret, errors.New("remote connect fail")
}
Expand Down

0 comments on commit 41a1adc

Please sign in to comment.