Made it asynchronous.
parent
6c4f09f4cb
commit
08f139c8d2
|
@ -116,11 +116,20 @@ func (b *AbstractBridge) WaitAndClean(entity AbstractMulticast) {
|
||||||
|
|
||||||
log.Println("Inizializing Escalator")
|
log.Println("Inizializing Escalator")
|
||||||
|
|
||||||
for {
|
|
||||||
entity.AddUniqueAndSort(b.hIerarchyNumber)
|
entity.AddUniqueAndSort(b.hIerarchyNumber)
|
||||||
|
|
||||||
|
brIp, _, err := net.ParseCIDR(b.BridgeIpCIDR)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
|
||||||
pollTime := len(entity.HierarchyArray) + 1
|
pollTime := len(entity.HierarchyArray) + 1
|
||||||
time.Sleep(time.Duration(pollTime) * time.Second)
|
time.Sleep(time.Duration(pollTime) * time.Second)
|
||||||
// svuotare l'array
|
// svuotare l'array e rifare le elezioni
|
||||||
|
if !isActive(string(brIp)) {
|
||||||
entity.HierarchyArray = entity.HierarchyArray[:0]
|
entity.HierarchyArray = entity.HierarchyArray[:0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue