commit 2021-12-12]13:11:51

This commit is contained in:
Godopu 2021-12-12 13:11:56 +09:00
parent 29a7d73791
commit 0788b44783

View File

@ -65,10 +65,15 @@ func (sh *SyncHandler) Handle(e Event) {
return return
} }
_, ok := sh.chanForSync[device.IfaceName]
if ok {
close(sh.chanForSync[device.IfaceName])
}
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 sh.chanForSync[device.IfaceName] { for state := range chanForSync {
if compareMap(origin, state) { if compareMap(origin, state) {
log.Println("Same!!")
close(sh.chanForSync[device.IfaceName]) close(sh.chanForSync[device.IfaceName])
delete(sh.chanForSync, device.IfaceName) delete(sh.chanForSync, device.IfaceName)
return return