Skip to content

Commit 9f5ddeb

Browse files
sukunrtMarcoPolo
authored andcommitted
simplify error type check
1 parent 3f0bd2a commit 9f5ddeb

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

conn.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,6 @@ func (c *Conn) readAndBuffer(ctx context.Context) error {
625625
hasHandshake = true
626626
}
627627

628-
var e *alertError
629-
if errors.As(err, &e) && e.IsFatalOrCloseNotify() {
630-
return e
631-
}
632628
if err != nil {
633629
return err
634630
}
@@ -660,10 +656,11 @@ func (c *Conn) handleQueuedPackets(ctx context.Context) error {
660656
}
661657
}
662658
var e *alertError
663-
if errors.As(err, &e) && e.IsFatalOrCloseNotify() {
664-
return e
665-
}
666-
if err != nil {
659+
if errors.As(err, &e) {
660+
if e.IsFatalOrCloseNotify() {
661+
return e
662+
}
663+
} else if err != nil {
667664
return err
668665
}
669666
}

0 commit comments

Comments
 (0)