mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
group: show the count of enabled proxies (#292)
This commit is contained in:
1 parent
2c8a5065fa
commit
3c431ee6e1
3 files changed
+7
-5
No files matched your search
+4
-2
@@ -159,20 +159,22 @@ func (p *FwdrGroup) onStatusChanged(fwdr *Forwarder) {
|
||||
defer p.mu.Unlock()
|
||||
|
||||
if fwdr.Enabled() {
|
||||
log.F("[group] %s(%d) changed status from DISABLED to ENABLED ", fwdr.Addr(), fwdr.Priority())
|
||||
if fwdr.Priority() == p.Priority() {
|
||||
p.avail = append(p.avail, fwdr)
|
||||
} else if fwdr.Priority() > p.Priority() {
|
||||
p.init()
|
||||
}
|
||||
log.F("[group] %s(%d) changed status from DISABLED to ENABLED (%d of %d currently enabled)",
|
||||
fwdr.Addr(), fwdr.Priority(), len(p.avail), len(p.fwdrs))
|
||||
} else {
|
||||
log.F("[group] %s(%d) changed status from ENABLED to DISABLED", fwdr.Addr(), fwdr.Priority())
|
||||
for i, f := range p.avail {
|
||||
if f == fwdr {
|
||||
p.avail[i], p.avail = p.avail[len(p.avail)-1], p.avail[:len(p.avail)-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
log.F("[group] %s(%d) changed status from ENABLED to DISABLED (%d of %d currently enabled)",
|
||||
fwdr.Addr(), fwdr.Priority(), len(p.avail), len(p.fwdrs))
|
||||
}
|
||||
|
||||
if len(p.avail) == 0 {
|
||||
|
||||
Reference in new issue
Block a user