Procházet zdrojové kódy

Update ua_client_highlevel_subscriptions.c

StalderT před 9 roky
rodič
revize
7384bb71e7
1 změnil soubory, kde provedl 6 přidání a 2 odebrání
  1. 6 2
      src/client/ua_client_highlevel_subscriptions.c

+ 6 - 2
src/client/ua_client_highlevel_subscriptions.c

@@ -274,7 +274,10 @@ UA_Client_processPublishRx(UA_Client *client, UA_PublishResponse response) {
     return response.moreNotifications;
 }
 
-void UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
+UA_StatusCode UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
+    if (client->state == UA_CLIENTSTATE_ERRORED){
+        return UA_STATUSCODE_BADSERVERNOTCONNECTED;
+    }
     UA_Boolean moreNotifications = UA_TRUE;
     do {
         UA_PublishRequest request;
@@ -288,7 +291,7 @@ void UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
             request.subscriptionAcknowledgements = UA_malloc(sizeof(UA_SubscriptionAcknowledgement) *
                                                              request.subscriptionAcknowledgementsSize);
             if(!request.subscriptionAcknowledgements)
-                return;
+                return UA_STATUSCODE_GOOD;
         }
         
         int index = 0 ;
@@ -307,4 +310,5 @@ void UA_Client_Subscriptions_manuallySendPublishRequest(UA_Client *client) {
         UA_PublishResponse_deleteMembers(&response);
         UA_PublishRequest_deleteMembers(&request);
     } while(moreNotifications == UA_TRUE);
+    return UA_STATUSCODE_GOOD;
 }