Browse Source

add requestedSessionTimeout to UA_ClientConfig (#2291)

Gabriel do Nascimento Ribeiro 5 years ago
parent
commit
02dc4178ce

+ 3 - 0
include/ua_client_config.h

@@ -71,6 +71,9 @@ typedef struct {
     * 0 = background task disabled */
     UA_UInt32 connectivityCheckInterval;
 
+    /* session timeout in ms */
+    UA_UInt32 requestedSessionTimeout;
+
     /* When connectivityCheckInterval is greater than 0, every
      * connectivityCheckInterval (in ms), a async read request is performed on
      * the server. inactivityCallback is called when the client receive no

+ 2 - 0
plugins/ua_config_default.c

@@ -727,6 +727,8 @@ const UA_ClientConfig UA_ClientConfig_default = {
     NULL, /* .stateCallback */
     0,    /* .connectivityCheckInterval */
 
+    1200000, /* requestedSessionTimeout */
+
     NULL, /* .inactivityCallback */
     NULL, /* .clientContext */
 

+ 1 - 1
src/client/ua_client_connect.c

@@ -511,7 +511,7 @@ createSession(UA_Client *client) {
     request.requestHeader.timestamp = UA_DateTime_now();
     request.requestHeader.timeoutHint = 10000;
     UA_ByteString_copy(&client->channel.localNonce, &request.clientNonce);
-    request.requestedSessionTimeout = 1200000;
+    request.requestedSessionTimeout = client->config.requestedSessionTimeout;
     request.maxResponseMessageSize = UA_INT32_MAX;
     UA_String_copy(&client->endpointUrl, &request.endpointUrl);
 

+ 1 - 1
src/client/ua_client_connect_async.c

@@ -508,7 +508,7 @@ requestSession(UA_Client *client, UA_UInt32 *requestId) {
     request.requestHeader.timestamp = UA_DateTime_now();
     request.requestHeader.timeoutHint = 10000;
     UA_ByteString_copy(&client->channel.localNonce, &request.clientNonce);
-    request.requestedSessionTimeout = 1200000;
+    request.requestedSessionTimeout = client->config.requestedSessionTimeout;
     request.maxResponseMessageSize = UA_INT32_MAX;
     UA_String_copy(&client->endpointUrl, &request.endpointUrl);