Skip to content

Commit

Permalink
client: exit client on timeout when auto-reconnect is disabled
Browse files Browse the repository at this point in the history
Fixes #504
  • Loading branch information
magiconair committed Dec 9, 2021
1 parent af18ddc commit f71faec
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ func (c *Client) monitor(ctx context.Context) {
switch x := err.(type) {
case *uacp.Error:
switch ua.StatusCode(x.ErrorCode) {
case ua.StatusBadTimeout:
if !c.cfg.sechan.AutoReconnect {
// the server is not responding and the connection should not be restored
action = abortReconnect
dlog.Print("auto-reconnect disabled")
return
}

case ua.StatusBadSecureChannelIDInvalid:
// the secure channel has been rejected by the server
action = createSecureChannel
Expand Down

0 comments on commit f71faec

Please sign in to comment.