Skip to content

Commit

Permalink
Check err
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyech committed Feb 13, 2024
1 parent 0b4c945 commit 4b1c669
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/dtls/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ func (c *hbConn) recvLoop() {
for {
buffer := make([]byte, c.maxMessageSize)

c.stream.SetReadDeadline(time.Now().Add(c.timeout))
err := c.stream.SetReadDeadline(time.Now().Add(c.timeout))
if err != nil {
c.Close()
return
}

n, err := c.stream.Read(buffer)

if bytes.Equal(c.hb, buffer[:n]) {
Expand Down

0 comments on commit 4b1c669

Please sign in to comment.