szaszm commented on a change in pull request #805:
URL: https://github.com/apache/nifi-minifi-cpp/pull/805#discussion_r438124894



##########
File path: libminifi/src/FlowControlProtocol.cpp
##########
@@ -162,11 +164,12 @@ int FlowControlProtocol::sendRegisterReq() {
     return -1;
 
   // Calculate the total payload msg size
-  uint32_t payloadSize = FlowControlMsgIDEncodingLen(FLOW_SERIAL_NUMBER, 0) + 
FlowControlMsgIDEncodingLen(FLOW_YML_NAME, this->_controller->getName().size() 
+ 1);
-  uint32_t size = sizeof(FlowControlProtocolHeader) + payloadSize;
+  const auto payloadSize = FlowControlMsgIDEncodingLen(FLOW_SERIAL_NUMBER, 0) 
+ FlowControlMsgIDEncodingLen(FLOW_YML_NAME, 
gsl::narrow<int>(this->_controller->getName().size() + 1));

Review comment:
       I don't think it would ever throw/terminate in practice. The thread that 
initiates the termination shouldn't matter, it crashes the whole process by 
default.
   
   If it actually happened in a version that throws instead of terminate, a log 
line would indeed be helpful in debugging, but I think the chances of this is 
so low that it's not worth complicating the code with the log line.




----------------------------------------------------------------
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.

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


Reply via email to