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