From 78148f9de82e526833cb9098cf667c9654bb67a3 Mon Sep 17 00:00:00 2001 From: Kai Huebl Date: Wed, 17 May 2023 09:37:34 +0200 Subject: [PATCH] prevent duplicate events --- .../ServiceSetApplication/ApplicationService.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/OpcUaStackServer/ServiceSetApplication/ApplicationService.cpp b/src/OpcUaStackServer/ServiceSetApplication/ApplicationService.cpp index 91efe7cb5..ccefe234d 100644 --- a/src/OpcUaStackServer/ServiceSetApplication/ApplicationService.cpp +++ b/src/OpcUaStackServer/ServiceSetApplication/ApplicationService.cpp @@ -718,6 +718,7 @@ namespace OpcUaStackServer for (nodeIt = nodeIdVec.begin(); nodeIt != nodeIdVec.end(); nodeIt++) { boost::mutex::scoped_lock g(eventHandlerMap.mutex()); + eventHandlerBaseVec.clear(); eventHandlerMap.getEvent(*nodeIt, eventHandlerBaseVec); for (it = eventHandlerBaseVec.begin(); it != eventHandlerBaseVec.end(); it++) { EventHandlerBase::SPtr eventHandlerBase = *it; @@ -725,7 +726,8 @@ namespace OpcUaStackServer Log(Debug, "fire event") .parameter("NumberEvents", eventHandlerBaseVec.size()) .parameter("Node", fireEventRequest->nodeId()) - .parameter("EventId", eventHandlerBase->eventId()); + .parameter("EventId", eventHandlerBase->eventId()) + .parameter("NodeVecElement", *nodeIt); eventHandlerBase->fireEvent(fireEventRequest->nodeId(), fireEventRequest->eventBase()); }