瀏覽代碼

Client: Deprecate UA_Client_manuallyRenewSecureChannel

Julius Pfrommer 6 年之前
父節點
當前提交
59a3cfb856
共有 5 個文件被更改,包括 14 次插入19 次删除
  1. 7 6
      include/ua_client.h
  2. 1 1
      src/client/ua_client.c
  3. 1 10
      src/client/ua_client_connect.c
  4. 3 0
      src/client/ua_client_internal.h
  5. 2 2
      src/client/ua_client_worker.c

+ 7 - 6
include/ua_client.h

@@ -152,10 +152,6 @@ UA_Client_close(UA_Client *client) {
     return UA_Client_disconnect(client);
 }
 
-/* Renew the underlying secure channel */
-UA_StatusCode UA_EXPORT
-UA_Client_manuallyRenewSecureChannel(UA_Client *client);
-
 /**
  * Discovery
  * --------- */
@@ -429,8 +425,8 @@ UA_Client_sendAsyncRequest(UA_Client *client, const void *request,
         const UA_DataType *responseType, void *userdata, UA_UInt32 *requestId);
 
 /* Listen on the network and process arriving asynchronous responses in the
- * background. Internal housekeeping and subscription management is done as
- * well. */
+ * background. Internal housekeeping, renewal of SecureChannels and subscription
+ * management is done as well. */
 UA_StatusCode UA_EXPORT
 UA_Client_run_iterate(UA_Client *client, UA_UInt16 timeout);
 
@@ -439,6 +435,11 @@ UA_Client_runAsync(UA_Client *client, UA_UInt16 timeout) {
     return UA_Client_run_iterate(client, timeout);
 }
 
+UA_DEPRECATED static UA_INLINE UA_StatusCode
+UA_Client_manuallyRenewSecureChannel(UA_Client *client) {
+    return UA_Client_run_iterate(client, 0);
+}
+
 /* Use the type versions of this method. See below. However, the general
  * mechanism of async service calls is explained here.
  *

+ 1 - 1
src/client/ua_client.c

@@ -289,7 +289,7 @@ static UA_StatusCode
 sendSymmetricServiceRequest(UA_Client *client, const void *request,
                             const UA_DataType *requestType, UA_UInt32 *requestId) {
     /* Make sure we have a valid session */
-    UA_StatusCode retval = UA_Client_manuallyRenewSecureChannel(client);
+    UA_StatusCode retval = openSecureChannel(client, true);
     if(retval != UA_STATUSCODE_GOOD)
         return retval;
 

+ 1 - 10
src/client/ua_client_connect.c

@@ -184,7 +184,7 @@ processDecodedOPNResponse(UA_Client *client, UA_OpenSecureChannelResponse *respo
         (client->channel.securityToken.revisedLifetime * (UA_Double)UA_DATETIME_MSEC * 0.75);
 }
 
-static UA_StatusCode
+UA_StatusCode
 openSecureChannel(UA_Client *client, UA_Boolean renew) {
     /* Check if sc is still valid */
     if(renew && client->nextChannelRenewal > UA_DateTime_nowMonotonic())
@@ -687,15 +687,6 @@ UA_Client_connect_username(UA_Client *client, const char *endpointUrl,
     return UA_Client_connect(client, endpointUrl);
 }
 
-UA_StatusCode
-UA_Client_manuallyRenewSecureChannel(UA_Client *client) {
-    UA_StatusCode retval = openSecureChannel(client, true);
-    if(retval != UA_STATUSCODE_GOOD)
-        UA_Client_disconnect(client);
-
-    return retval;
-}
-
 /************************/
 /* Close the Connection */
 /************************/

+ 3 - 0
src/client/ua_client_internal.h

@@ -207,6 +207,9 @@ UA_Client_getEndpointsInternal(UA_Client *client,
 UA_StatusCode
 receivePacketAsync(UA_Client *client);
 
+UA_StatusCode
+openSecureChannel(UA_Client *client, UA_Boolean renew);
+
 UA_StatusCode
 receiveServiceResponse(UA_Client *client, void *response,
                        const UA_DataType *responseType, UA_DateTime maxDate,

+ 2 - 2
src/client/ua_client_worker.c

@@ -164,8 +164,8 @@ UA_StatusCode UA_Client_run_iterate(UA_Client *client, UA_UInt16 timeout) {
     if(client->state >= UA_CLIENTSTATE_SESSION && retvalPublish != UA_STATUSCODE_GOOD)
         return retvalPublish;
 #endif
-    if(timeout){
-        retval = UA_Client_manuallyRenewSecureChannel(client);
+    if(timeout) {
+        retval = openSecureChannel(client, true);
         if(retval != UA_STATUSCODE_GOOD)
             return retval;