From a78da1182e17e7957176f3800f2b32156432d954 Mon Sep 17 00:00:00 2001 From: Jianhui Zhao Date: Fri, 26 Apr 2024 22:39:48 +0800 Subject: [PATCH] fix: Fix the issue of device unregistered message print twice ``` Device 'x' unregistered Device 'x' unregistered ``` Signed-off-by: Jianhui Zhao --- broker.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/broker.go b/broker.go index 2e43a32..3c793c1 100644 --- a/broker.go +++ b/broker.go @@ -133,12 +133,16 @@ func (br *broker) run() { c.Close() if c.IsDevice() { - if !c.(*device).registered { + dev := c.(*device) + + if !dev.registered { break } delete(br.devices, devid) + dev.registered = false + for sid, s := range br.sessions { if s.dev == c { s.user.Close()