mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-03-04 02:14:40 +01:00
updating_until -> updatingUntil
This commit is contained in:
parent
a4cbc66fdd
commit
3f3cd1e67d
1 changed files with 6 additions and 6 deletions
|
@ -40,9 +40,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type CachedIPItem struct {
|
type CachedIPItem struct {
|
||||||
ip net.IP
|
ip net.IP
|
||||||
expiration *time.Time
|
expiration *time.Time
|
||||||
updating_until *time.Time
|
updatingUntil *time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type CachedIPs struct {
|
type CachedIPs struct {
|
||||||
|
@ -106,7 +106,7 @@ func ParseIP(ipStr string) net.IP {
|
||||||
// If ttl < 0, never expire
|
// If ttl < 0, never expire
|
||||||
// Otherwise, ttl is set to max(ttl, MinResolverIPTTL)
|
// Otherwise, ttl is set to max(ttl, MinResolverIPTTL)
|
||||||
func (xTransport *XTransport) saveCachedIP(host string, ip net.IP, ttl time.Duration) {
|
func (xTransport *XTransport) saveCachedIP(host string, ip net.IP, ttl time.Duration) {
|
||||||
item := &CachedIPItem{ip: ip, expiration: nil, updating_until: nil}
|
item := &CachedIPItem{ip: ip, expiration: nil, updatingUntil: nil}
|
||||||
if ttl >= 0 {
|
if ttl >= 0 {
|
||||||
if ttl < MinResolverIPTTL {
|
if ttl < MinResolverIPTTL {
|
||||||
ttl = MinResolverIPTTL
|
ttl = MinResolverIPTTL
|
||||||
|
@ -126,7 +126,7 @@ func (xTransport *XTransport) markUpdatingCachedIP(host string) {
|
||||||
if ok {
|
if ok {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
until := now.Add(xTransport.timeout)
|
until := now.Add(xTransport.timeout)
|
||||||
item.updating_until = &until
|
item.updatingUntil = &until
|
||||||
xTransport.cachedIPs.cache[host] = item
|
xTransport.cachedIPs.cache[host] = item
|
||||||
}
|
}
|
||||||
xTransport.cachedIPs.Unlock()
|
xTransport.cachedIPs.Unlock()
|
||||||
|
@ -144,7 +144,7 @@ func (xTransport *XTransport) loadCachedIP(host string) (ip net.IP, expired bool
|
||||||
expiration := item.expiration
|
expiration := item.expiration
|
||||||
if expiration != nil && time.Until(*expiration) < 0 {
|
if expiration != nil && time.Until(*expiration) < 0 {
|
||||||
expired = true
|
expired = true
|
||||||
if item.updating_until != nil && time.Until(*item.updating_until) > 0 {
|
if item.updatingUntil != nil && time.Until(*item.updatingUntil) > 0 {
|
||||||
updating = true
|
updating = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue