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


##########
libminifi/src/c2/ControllerSocketProtocol.cpp:
##########
@@ -66,7 +69,49 @@ 
ControllerSocketProtocol::ControllerSocketProtocol(core::controller::ControllerS
         configuration_(std::move(configuration)),
         socket_restart_processor_(update_sink_) {
   gsl_Expects(configuration_);
-  stream_factory_ = minifi::io::StreamFactory::getInstance(configuration_);
+}
+
+ControllerSocketProtocol::~ControllerSocketProtocol() {
+  stopListener();
+}
+
+void ControllerSocketProtocol::stopListener() {
+  io_context_.stop();
+  if (acceptor_) {
+    acceptor_->close();
+  }
+  if (server_thread_.joinable()) {
+    server_thread_.join();
+  }
+  io_context_.restart();
+}
+
+void ControllerSocketProtocol::startAccept() {
+  acceptor_->async_accept([this](const asio::error_code& error, 
asio::ip::tcp::socket socket) {

Review Comment:
   Thanks! Rewritten in da7844db28b0ee3a782ca2c2d2e1ffe4dfbebc73



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