Skip to content

Commit

Permalink
fix: deadlock caused by sending keepalive frame
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Dec 15, 2021
1 parent 0e7632d commit 43ed146
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion device.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ func (dev *device) writeLoop() {

if now.Sub(lastHeartbeat) > heartbeatInterval-1 {
lastHeartbeat = now
dev.WriteMsg(msgTypeHeartbeat, []byte{})
if len(dev.send) < 1 {
dev.WriteMsg(msgTypeHeartbeat, []byte{})
}
}
}
}
Expand Down

0 comments on commit 43ed146

Please sign in to comment.