Revert "Refresh prepared domain every 30 minutes"

This reverts commit 903352ec9c.
This commit is contained in:
yuhan6665
2020-08-05 20:22:01 -04:00
parent 6afd4d0549
commit af7dfc3a43
2 changed files with 6 additions and 14 deletions

View File

@@ -24,7 +24,6 @@ type resolved struct {
domain string
IPs []net.IP
Port int
lastResolved time.Time
ipIdx uint8
ipLock sync.Mutex
lastSwitched time.Time
@@ -98,7 +97,7 @@ func (d *ProtectedDialer) PrepareResolveChan() {
d.resolveChan = make(chan struct{})
}
func (d *ProtectedDialer) ResolveChan() chan struct{} {
func (d *ProtectedDialer) ResolveChan() <-chan struct{} {
return d.resolveChan
}
@@ -138,10 +137,9 @@ func (d *ProtectedDialer) lookupAddr(addr string) (*resolved, error) {
}
rs := &resolved{
domain: host,
IPs: IPs,
Port: portnum,
lastResolved: time.Now(),
domain: host,
IPs: IPs,
Port: portnum,
}
return rs, nil
@@ -152,6 +150,7 @@ func (d *ProtectedDialer) PrepareDomain(domainName string, closeCh <-chan struct
log.Printf("Preparing Domain: %s", domainName)
d.currentServer = domainName
defer close(d.resolveChan)
maxRetry := 10
for {
if maxRetry == 0 {
@@ -213,10 +212,6 @@ func (d *ProtectedDialer) Dial(ctx context.Context,
}
}
if time.Now().Sub(d.vServer.lastResolved) > time.Minute * 30 {
d.PrepareDomain(Address, nil)
}
fd, err := d.getFd(dest.Network)
if err != nil {
return nil, err