zhixinwen commented on code in PR #3061:
URL: https://github.com/apache/kvrocks/pull/3061#discussion_r2217054921


##########
src/cluster/replication.cc:
##########
@@ -75,6 +75,11 @@ Status FeedSlaveThread::Start() {
 
   if (s) {
     t_ = std::move(*s);
+
+    // Re-enable the bufferevent and set up callbacks after detachment
+    auto bev = conn_->GetBufferEvent();
+    bufferevent_enable(bev, EV_READ);
+    bufferevent_setcb(bev, &FeedSlaveThread::staticReadCallback, nullptr, 
nullptr, this);

Review Comment:
   In `this->loop`, we send data to file descriptor directly in a different 
thread. Here we can using `bufferevent` to read from the file descriptor in the 
callback. I think it is ok, because in the callback we only read, and in the 
loop, we only write. But I am not very familiar with this lib and C..



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