lordgamez commented on code in PR #2266:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2266#discussion_r4630989764


##########
extensions/opc/include/OPCCommon.h:
##########


Review Comment:
   Good catch, updated in 
https://github.com/apache/nifi-minifi-cpp/pull/2266/commits/fae789d66592feb4d8ec8c4a4faf47b2edf5a7df



##########
extensions/opc/src/BaseOPCProcessor.cpp:
##########
@@ -92,37 +93,40 @@ bool BaseOPCProcessor::reconnect() {
     return false;
   }
   logger_->log_debug("Successfully connected.");
+
+  // A new or re-established connection may be to a restarted server that can 
reassign node ids,
+  // so if path is used to identify node id, the cached node id should be 
invalidated
+  path_node_id_resolved_ = false;

Review Comment:
   Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/2266/commits/fae789d66592feb4d8ec8c4a4faf47b2edf5a7df



##########
extensions/opc/src/OPCCommon.cpp:
##########
@@ -224,7 +235,20 @@ NodeData Client::getNodeData(const UA_ReferenceDescription 
*ref, const std::stri
     } else if (ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_NUMERIC) {
       nodedata.attributes["node.id"] = 
std::to_string(ref->nodeId.nodeId.identifier.numeric);  // 
NOLINT(cppcoreguidelines-pro-type-union-access)
       nodedata.attributes["node.id.type"] = "numeric";
+    } else if (ref->nodeId.nodeId.identifierType == UA_NODEIDTYPE_GUID) {
+      const auto& guid = ref->nodeId.nodeId.identifier.guid;  // 
NOLINT(cppcoreguidelines-pro-type-union-access)
+      std::array<char, 37> guid_str_array{};
+      auto res = snprintf(guid_str_array.data(), guid_str_array.size(), 
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+                          guid.data1, guid.data2, guid.data3, guid.data4[0], 
guid.data4[1], guid.data4[2],
+                          guid.data4[3], guid.data4[4], guid.data4[5], 
guid.data4[6], guid.data4[7]);
+      if (res < 0) {
+        nodedata.attributes["node.id"] = "";
+      } else {
+        nodedata.attributes["node.id"] = std::string(guid_str_array.data());
+      }

Review Comment:
   Good point, replaced in 
https://github.com/apache/nifi-minifi-cpp/pull/2266/commits/fae789d66592feb4d8ec8c4a4faf47b2edf5a7df



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to