Skip to content

Commit

Permalink
fix: Fix the issue of device unregistered message print twice
Browse files Browse the repository at this point in the history
```
Device 'x' unregistered
Device 'x' unregistered
```

Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Apr 26, 2024
1 parent d74d9d2 commit a78da11
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a78da11

Please sign in to comment.