commit 2021-12-12]13:22:50

This commit is contained in:
Godopu 2021-12-12 13:22:53 +09:00
parent 0788b44783
commit 31b00fb912

View File

@ -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
} }
} }