Skip to content

Commit

Permalink
feat: client error handler accept reconnect error (#823)
Browse files Browse the repository at this point in the history
  • Loading branch information
woorui authored May 22, 2024
1 parent 8960899 commit 3adc2a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,21 @@ CONNECT:
}

func (c *Client) handleConnectResult(err error, alwaysReconnect bool) (reconnect bool, se error) {
if c.ctx.Err() != nil {
if c.errorfn != nil && err != nil {
c.errorfn(err)
}
select {
case <-c.ctx.Done():
close(c.reConnect)
return false, err
default:
}
if err == nil {
c.Logger.Info("connected to zipper")
return false, nil
}
if e := new(ErrRejected); errors.As(err, &e) {
close(c.reConnect)
c.Logger.Info("handshake be rejected", "err", e.Message)
return false, err
}
Expand Down

0 comments on commit 3adc2a0

Please sign in to comment.