Bladeren bron

fix(pubsub) moved code for the SequenceNumber to the right section

Andreas Ebner 5 jaren geleden
bovenliggende
commit
47fb3c3269
3 gewijzigde bestanden met toevoegingen van 8 en 7 verwijderingen
  1. 5 5
      src/pubsub/ua_pubsub_networkmessage.c
  2. 2 1
      src/pubsub/ua_pubsub_ns0.c
  3. 1 1
      src/pubsub/ua_pubsub_writer.c

+ 5 - 5
src/pubsub/ua_pubsub_networkmessage.c

@@ -744,6 +744,10 @@ UA_NetworkMessage_calcSizeBinary(UA_NetworkMessage *p, UA_NetworkMessageOffsetBu
             size += UA_UInt32_calcSizeBinary(&p->groupHeader.groupVersion);
 
         if(p->groupHeader.networkMessageNumberEnabled) {
+            size += UA_UInt16_calcSizeBinary(&p->groupHeader.networkMessageNumber);
+        }
+
+        if(p->groupHeader.sequenceNumberEnabled){
             if(offsetBuffer){
                 size_t pos = offsetBuffer->offsetsSize;
                 if(!increaseOffsetArray(offsetBuffer))
@@ -755,10 +759,6 @@ UA_NetworkMessage_calcSizeBinary(UA_NetworkMessage *p, UA_NetworkMessageOffsetBu
                                      &p->groupHeader.sequenceNumber, &UA_TYPES[UA_TYPES_UINT16]);
                 offsetBuffer->offsets[pos].contentType = UA_PUBSUB_OFFSETTYPE_NETWORKMESSAGE_SEQUENCENUMBER;
             }
-            size += UA_UInt16_calcSizeBinary(&p->groupHeader.networkMessageNumber);
-        }
-
-        if(p->groupHeader.sequenceNumberEnabled){
             size += UA_UInt16_calcSizeBinary(&p->groupHeader.sequenceNumber);
         }
     }
@@ -1414,4 +1414,4 @@ void UA_DataSetMessage_free(const UA_DataSetMessage* p) {
         }
     }
 }
-#endif /* UA_ENABLE_PUBSUB */
+#endif /* UA_ENABLE_PUBSUB */

+ 2 - 1
src/pubsub/ua_pubsub_ns0.c

@@ -6,6 +6,7 @@
  * Copyright (c) 2019 Kalycito Infotech Private Limited
  */
 
+#include <open62541/types.h>
 #include "ua_pubsub_ns0.h"
 
 #ifdef UA_ENABLE_PUBSUB_INFORMATIONMODEL /* conditional compilation */
@@ -749,7 +750,7 @@ addWriterGroupRepresentation(UA_Server *server, UA_WriterGroup *writerGroup){
     //This code block must use a lock
     UA_NODESTORE_REMOVE(server, &writerGroup->identifier);
     retVal |= addPubSubObjectNode(server, wgName, writerGroup->identifier.identifier.numeric,
-                                  writerGroup->linkedConnection.identifier.numeric,
+                                  writerGroup->linkedConnection->identifier.identifier.numeric,
                                   UA_NS0ID_HASCOMPONENT, UA_NS0ID_WRITERGROUPTYPE);
     //End lock zone
     UA_NodeId keepAliveNode =

+ 1 - 1
src/pubsub/ua_pubsub_writer.c

@@ -2046,4 +2046,4 @@ UA_WriterGroup_addPublishCallback(UA_Server *server, UA_WriterGroup *writerGroup
     return retval;
 }
 
-#endif /* UA_ENABLE_PUBSUB */
+#endif /* UA_ENABLE_PUBSUB */