mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dhcpd: assign random ip
This commit is contained in:
1 parent
5b774cf90e
commit
de8c08c7b2
8 files changed
+46
-49
No files matched your search
+5
-2
@@ -115,10 +115,13 @@ func (f *Forwarder) Failures() uint32 {
|
||||
// IncFailures increase the failuer count by 1.
|
||||
func (f *Forwarder) IncFailures() {
|
||||
failures := atomic.AddUint32(&f.failures, 1)
|
||||
if f.MaxFailures() == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
log.F("[forwarder] %s recorded %d failures, maxfailures: %d", f.addr, failures, f.MaxFailures())
|
||||
|
||||
if f.MaxFailures() != 0 && failures >= f.MaxFailures() && f.Enabled() {
|
||||
log.F("[forwarder] %s reaches maxfailures %d", f.addr, f.MaxFailures())
|
||||
if failures >= f.MaxFailures() && f.Enabled() {
|
||||
f.Disable()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -271,7 +271,7 @@ func checkWebSite(fwdr *Forwarder, website string, timeout time.Duration, buf []
|
||||
}
|
||||
|
||||
fwdr.Enable()
|
||||
log.F("[check] %s(%d) -> %s, SUCCEEDED. connect time: %s", fwdr.Addr(), fwdr.Priority(),
|
||||
log.F("[check] %s(%d) -> %s, SUCCESS. connect time: %s", fwdr.Addr(), fwdr.Priority(),
|
||||
website, readTime)
|
||||
|
||||
return true
|
||||
|
||||
Reference in new issue
Block a user