From f71faeca4a283c27d7327a5d2852f295c570528b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Schr=C3=B6der?= Date: Thu, 9 Dec 2021 09:54:22 +0100 Subject: [PATCH] client: exit client on timeout when auto-reconnect is disabled Fixes #504 --- client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client.go b/client.go index 776624da..a6d4d3a1 100644 --- a/client.go +++ b/client.go @@ -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