Skip to content

Commit

Permalink
Return correct error
Browse files Browse the repository at this point in the history
  • Loading branch information
mingyech committed Oct 17, 2023
1 parent 16c0b54 commit 1f4c083
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/dtls/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,17 @@ func (c *hbConn) Write(b []byte) (n int, err error) {
return c.conn.Write(b)
}

func (c *hbConn) Read(b []byte) (n int, err error) {
func (c *hbConn) Read(b []byte) (int, error) {
readBytes := <-c.recvCh
if readBytes.err != nil {
return 0, err
return 0, readBytes.err
}

if len(b) < len(readBytes.b) {
return 0, ErrInsufficientBuffer
}

n = copy(b, readBytes.b)
n := copy(b, readBytes.b)

return n, nil
}
Expand Down

0 comments on commit 1f4c083

Please sign in to comment.