Browse Source

Fix the missing message detection in the client subscription

More than one consecutive keepalive message and the first notification
message after a keepalive message share the same sequence number.
There should be no warning for these cases.
Jannis Voelker 6 years ago
parent
commit
08f496531c
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/client/ua_client_subscriptions.c

+ 6 - 1
src/client/ua_client_subscriptions.c

@@ -649,7 +649,12 @@ UA_Client_Subscriptions_processPublishResponse(UA_Client *client, UA_PublishRequ
         /* UA_Client_close(client);
            return; */
     }
-    sub->sequenceNumber = msg->sequenceNumber;
+    /* According to f), a keep-alive message contains no notifications and has the sequence number
+     * of the next NotificationMessage that is to be sent => More than one consecutive keep-alive
+     * message or a NotificationMessage following a keep-alive message will share the same sequence
+     * number. */
+    if (msg->notificationDataSize)
+        sub->sequenceNumber = msg->sequenceNumber;
 
     /* Process the notification messages */
     for(size_t k = 0; k < msg->notificationDataSize; ++k)