commit 2021-12-12]13:22:50
This commit is contained in:
parent
0788b44783
commit
31b00fb912
@ -68,9 +68,11 @@ func (sh *SyncHandler) Handle(e Event) {
|
|||||||
_, ok := sh.chanForSync[device.IfaceName]
|
_, ok := sh.chanForSync[device.IfaceName]
|
||||||
if ok {
|
if ok {
|
||||||
close(sh.chanForSync[device.IfaceName])
|
close(sh.chanForSync[device.IfaceName])
|
||||||
|
delete(sh.chanForSync, device.IfaceName)
|
||||||
}
|
}
|
||||||
chanForSync := make(chan map[string]interface{})
|
chanForSync := make(chan map[string]interface{})
|
||||||
sh.chanForSync[device.IfaceName] = make(chan map[string]interface{})
|
sh.chanForSync[device.IfaceName] = make(chan map[string]interface{})
|
||||||
|
|
||||||
for state := range chanForSync {
|
for state := range chanForSync {
|
||||||
|
|
||||||
if compareMap(origin, state) {
|
if compareMap(origin, state) {
|
||||||
@ -82,6 +84,7 @@ func (sh *SyncHandler) Handle(e Event) {
|
|||||||
log.Println("resend: ", origin)
|
log.Println("resend: ", origin)
|
||||||
err := encoder.Encode(origin)
|
err := encoder.Encode(origin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Println("sync routine is died")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user