From 1f4c083fa837f4b5b21e4873977948ec270634fb Mon Sep 17 00:00:00 2001 From: Mingye Chen Date: Tue, 17 Oct 2023 14:44:54 -0400 Subject: [PATCH] Return correct error --- pkg/dtls/heartbeat.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/dtls/heartbeat.go b/pkg/dtls/heartbeat.go index f16a5afe..22f20646 100644 --- a/pkg/dtls/heartbeat.go +++ b/pkg/dtls/heartbeat.go @@ -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 }