feat(common.opcua): Add session timeout as configuration option (#15341)

This commit is contained in:
maxime-jolliet-airseas 2024-05-15 17:06:43 +02:00 committed by GitHub
parent c31cf81761
commit c3c6189a1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 17 additions and 0 deletions

View File

@ -51,6 +51,7 @@ type OpcUAClientConfig struct {
OptionalFields []string `toml:"optional_fields"`
Workarounds OpcUAWorkarounds `toml:"workarounds"`
SessionTimeout config.Duration `toml:"session_timeout"`
}
func (o *OpcUAClientConfig) Validate() error {

View File

@ -159,6 +159,10 @@ func (o *OpcUAClient) generateClientOpts(endpoints []*ua.EndpointDescription) ([
opcua.RequestTimeout(time.Duration(o.Config.RequestTimeout)),
)
if o.Config.SessionTimeout != 0 {
opts = append(opts, opcua.SessionTimeout(time.Duration(o.Config.SessionTimeout)))
}
certFile := o.Config.Certificate
keyFile := o.Config.PrivateKey
policy := o.Config.SecurityPolicy

View File

@ -39,6 +39,9 @@ to use them.
#
## Maximum time allowed for a request over the established connection.
# request_timeout = "5s"
# Maximum time that a session shall remain open without activity.
# session_timeout = "20m"
#
## Security policy, one of "None", "Basic128Rsa15", "Basic256",
## "Basic256Sha256", or "auto"

View File

@ -11,6 +11,9 @@
#
## Maximum time allowed for a request over the established connection.
# request_timeout = "5s"
# Maximum time that a session shall remain open without activity.
# session_timeout = "20m"
#
## Security policy, one of "None", "Basic128Rsa15", "Basic256",
## "Basic256Sha256", or "auto"

View File

@ -57,6 +57,9 @@ to use them.
## Maximum time allowed for a request over the established connection.
# request_timeout = "5s"
#
# Maximum time that a session shall remain open without activity.
# session_timeout = "20m"
#
## The interval at which the server should at least update its monitored items
# subscription_interval = "100ms"
#

View File

@ -18,6 +18,9 @@
## Maximum time allowed for a request over the established connection.
# request_timeout = "5s"
#
# Maximum time that a session shall remain open without activity.
# session_timeout = "20m"
#
## The interval at which the server should at least update its monitored items
# subscription_interval = "100ms"
#