git-hulk commented on code in PR #3101:
URL: https://github.com/apache/kvrocks/pull/3101#discussion_r2255699489


##########
src/cluster/replication.cc:
##########
@@ -97,12 +97,17 @@ Status FeedSlaveThread::Start() {
 
 void FeedSlaveThread::Stop() {
   stop_ = true;
+  // disable read event so it would process the ack command
+  bufferevent_disable(conn_->GetBufferEvent(), EV_READ);
   warn("Slave thread was terminated, would stop feeding the slave: {}", 
conn_->GetAddr());
 }
 
 void FeedSlaveThread::Join() {
   if (auto s = util::ThreadJoin(t_); !s) {
     warn("Slave thread operation failed: {}", s.Msg());
+  } else {
+    // after the loop is finished, the connection can be freed
+    conn_.reset();

Review Comment:
   Yes, it should be correct to reset the unique pointer only here. Because the 
connection has been detached from the worker before using it in 
FeedSlaveThread, so it's nothing to be done.



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