From 60a3e4ab38e470e282114f169595ef6cfd7686dd Mon Sep 17 00:00:00 2001 From: sukun Date: Wed, 17 Apr 2024 23:28:53 +0530 Subject: [PATCH] simplify error type check --- conn.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/conn.go b/conn.go index 96b975846..7b18abea6 100644 --- a/conn.go +++ b/conn.go @@ -607,10 +607,6 @@ func (c *Conn) readAndBuffer(ctx context.Context) error { hasHandshake = true } - var e *alertError - if errors.As(err, &e) && e.IsFatalOrCloseNotify() { - return e - } if err != nil { return err } @@ -644,8 +640,7 @@ func (c *Conn) handleQueuedPackets(ctx context.Context) error { var e *alertError if errors.As(err, &e) && e.IsFatalOrCloseNotify() { return e - } - if err != nil { + } else if err != nil { return err } }