浏览代码

use clientHandle from MonitoredItem

Julius Pfrommer 6 年之前
父节点
当前提交
3dd6817a01
共有 3 个文件被更改,包括 3 次插入5 次删除
  1. 1 1
      src/server/ua_subscription.c
  2. 0 1
      src/server/ua_subscription.h
  3. 2 3
      src/server/ua_subscription_datachange.c

+ 1 - 1
src/server/ua_subscription.c

@@ -156,7 +156,7 @@ moveNotificationsFromMonitoredItems(UA_Subscription *sub, UA_MonitoredItemNotifi
         if(pos >= minsSize)
             return;
         UA_MonitoredItemNotification *min = &mins[pos];
-        min->clientHandle = notification->clientHandle;
+        min->clientHandle = notification->mon->clientHandle;
         if(notification->mon->monitoredItemType == UA_MONITOREDITEMTYPE_CHANGENOTIFY) {
             min->value = notification->data.value;
         } else {

+ 0 - 1
src/server/ua_subscription.h

@@ -43,7 +43,6 @@ typedef struct UA_Notification {
 
     UA_MonitoredItem *mon;
 
-    UA_UInt32 clientHandle;
     union {
         UA_Event event;
         UA_DataValue value;

+ 2 - 3
src/server/ua_subscription_datachange.c

@@ -269,7 +269,6 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub,
     } else {
         newNotification->data.value = *value; /* Just copy the value and do not release it */
     }
-    newNotification->clientHandle = monitoredItem->clientHandle;
 
     /* <-- Point of no return --> */
 
@@ -277,6 +276,8 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub,
                          "Subscription %u | MonitoredItem %u | Sampled a new value",
                          sub->subscriptionId, monitoredItem->monitoredItemId);
 
+    newNotification->mon = monitoredItem;
+
     /* Replace the encoding for comparison */
     UA_ByteString_deleteMembers(&monitoredItem->lastSampledValue);
     monitoredItem->lastSampledValue = *valueEncoding;
@@ -285,8 +286,6 @@ sampleCallbackWithValue(UA_Server *server, UA_Subscription *sub,
     TAILQ_INSERT_TAIL(&monitoredItem->queue, newNotification, listEntry);
     ++monitoredItem->currentQueueSize;
 
-    newNotification->mon = monitoredItem;
-
     /* Remove entries from the queue if required and add the sample to the global queue */
     MonitoredItem_ensureQueueSpace(sub, monitoredItem, newNotification);