lizhanhui commented on a change in pull request #60: feature: only one event 
loop for all TcpTransport.
URL: https://github.com/apache/rocketmq-client-cpp/pull/60#discussion_r247147640
 
 

 ##########
 File path: src/transport/TcpTransport.cpp
 ##########
 @@ -213,15 +143,15 @@ void TcpTransport::timeoutcb(evutil_socket_t fd, short 
what, void *arg) {
 
 void TcpTransport::eventcb(struct bufferevent *bev, short what, void *ctx) {
 
 Review comment:
   The shared_ptr/weak_ptr solution I am proposing is like this:
   1. TcpRmotingClient maintains a hash map between bufferevent* to weak_ptr of 
TcpTransport
   2. bufferevent_setcb, pass TcpRemotingClient pointer in, aka, 
bufferevent_setcb(m_bufferEvent, readNextMessageIntCallback, NULL, eventcb, 
m_tcpRemotingClient);
   3. In eventcb, lookup and test TcpTransport via weak_ptr::lock() 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to