diff --git a/main.go b/main.go index 4ee017b..820e446 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,7 @@ var listen = flag.String("l", ":9876", "监听地址") var every = flag.Int("f", 300, "同步间隔时间(秒)") // 缓存次数 -var ipCacheTimes = flag.Int("cacheTimes", 6, "间隔N次与服务商比对") +var ipCacheTimes = flag.Int("cacheTimes", 5, "间隔N次与服务商比对") // 服务管理 var serviceType = flag.String("s", "", "服务管理, 支持install, uninstall") diff --git a/util/ip_cache.go b/util/ip_cache.go index bf859f3..ae3db63 100644 --- a/util/ip_cache.go +++ b/util/ip_cache.go @@ -24,10 +24,10 @@ func (d *IpCache) Check(newAddr string) bool { if d.Addr != newAddr || d.Times <= 1 { IPCacheTimes, err := strconv.Atoi(os.Getenv(IPCacheTimesENV)) if err != nil { - IPCacheTimes = 6 + IPCacheTimes = 5 } d.Addr = newAddr - d.Times = IPCacheTimes + d.Times = IPCacheTimes + 1 return true } d.Addr = newAddr