feat(common.opcua): Add session timeout as configuration option (#15341)
This commit is contained in:
parent
c31cf81761
commit
c3c6189a1b
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
#
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in New Issue