修改错误ready不可达到的问题
This commit is contained in:
parent
a00de486e4
commit
aaa53b54e4
15
dip.go
15
dip.go
|
@ -79,10 +79,16 @@ func (group *DIPGroup) Choose(addr string) {
|
|||
|
||||
imokURL := "http://" + dhost.Host + ":8800/pppoe/imok"
|
||||
ses := requests.NewSession()
|
||||
ses.SetConfig(requests.CRequestTimeout, 5)
|
||||
ses.SetConfig(requests.CRequestTimeout, 4)
|
||||
|
||||
if _, err := ses.Get(imokURL).Execute(); err != nil {
|
||||
log.Println(err)
|
||||
if i == 2 {
|
||||
// 下个需要切换的DHost错误
|
||||
group.Current.ActiveTime = now + 15
|
||||
delete(group.Ready, ip)
|
||||
return // 不执行下面的 切换操作 for ip, dhost := range group.Ready
|
||||
}
|
||||
} else { // 如果ping 通下个切换的主机就切换
|
||||
for ii := 0; ii < 3; ii++ {
|
||||
restartURL := "http://" + group.Current.Host + ":8800/pppoe/restart"
|
||||
|
@ -96,13 +102,6 @@ func (group *DIPGroup) Choose(addr string) {
|
|||
}
|
||||
}
|
||||
|
||||
if i == 3 {
|
||||
// 下个需要切换的DHost错误
|
||||
group.Current.ActiveTime = now + 15
|
||||
delete(group.Ready, ip)
|
||||
return // 不执行下面的 切换操作 for ip, dhost := range group.Ready
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
group.Current = dhost
|
||||
|
|
Loading…
Reference in New Issue
Block a user