Skip to content

Commit

Permalink
simplify error type check
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt authored and MarcoPolo committed May 2, 2024
1 parent 3f0bd2a commit 9f5ddeb
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,10 +625,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
}
Expand Down Expand Up @@ -660,10 +656,11 @@ func (c *Conn) handleQueuedPackets(ctx context.Context) error {
}
}
var e *alertError
if errors.As(err, &e) && e.IsFatalOrCloseNotify() {
return e
}
if err != nil {
if errors.As(err, &e) {
if e.IsFatalOrCloseNotify() {
return e
}
} else if err != nil {
return err
}
}
Expand Down

0 comments on commit 9f5ddeb

Please sign in to comment.