zyearn commented on code in PR #1814:
URL: https://github.com/apache/incubator-brpc/pull/1814#discussion_r923810177


##########
src/brpc/selective_channel.cpp:
##########
@@ -189,6 +189,7 @@ int ChannelBalancer::AddChannel(ChannelBase* sub_channel,
     SocketOptions options;
     options.user = sub_chan;
     options.health_check_interval_s = FLAGS_channel_check_interval;
+    options.is_in_socket_map = true;

Review Comment:
   加在这里是不是不太合适,如果这里Create成功,外面Insert失败了,这里的状态就有点奇怪。最好在socket_map 
Insert或Remove成功的地方改socket的状态会更自然一点?



##########
src/brpc/input_messenger.cpp:
##########
@@ -439,6 +439,7 @@ int InputMessenger::Create(const butil::EndPoint& 
remote_side,
     options.user = this;
     options.on_edge_triggered_events = OnNewMessages;
     options.health_check_interval_s = health_check_interval_s;
+    options.is_in_socket_map = true;

Review Comment:
   同下



##########
src/brpc/selective_channel.cpp:
##########
@@ -223,6 +224,7 @@ void 
ChannelBalancer::RemoveAndDestroyChannel(SelectiveChannel::ChannelHandle ha
             CHECK_EQ(1UL, _chan_map.erase(sub->chan));
         }
         {
+            ptr->SetRemovedFromSocketMap(); // set removed status

Review Comment:
   
这里没有socket_map的操作突然调用一个SetRemovedFromSocketMap有点奇怪,可以统一在socket_map::remove里做吗?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to