From 31b00fb912da1aa575dd149edd60bb863c36994d Mon Sep 17 00:00:00 2001 From: Godopu Date: Sun, 12 Dec 2021 13:22:53 +0900 Subject: [PATCH] commit 2021-12-12]13:22:50 --- listener.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/listener.go b/listener.go index 08896e7..d1a3643 100644 --- a/listener.go +++ b/listener.go @@ -68,9 +68,11 @@ func (sh *SyncHandler) Handle(e Event) { _, ok := sh.chanForSync[device.IfaceName] if ok { close(sh.chanForSync[device.IfaceName]) + delete(sh.chanForSync, device.IfaceName) } chanForSync := make(chan map[string]interface{}) sh.chanForSync[device.IfaceName] = make(chan map[string]interface{}) + for state := range chanForSync { if compareMap(origin, state) { @@ -82,6 +84,7 @@ func (sh *SyncHandler) Handle(e Event) { log.Println("resend: ", origin) err := encoder.Encode(origin) if err != nil { + log.Println("sync routine is died") return } }