chenBright commented on code in PR #2177: URL: https://github.com/apache/brpc/pull/2177#discussion_r1148731172
########## src/brpc/controller.cpp: ########## @@ -749,9 +780,8 @@ void Controller::Call::OnComplete( // "single" streams are often maintained in a separate SocketMap and // different from the main socket as well. if (c->_stream_creator != NULL && - does_error_affect_main_socket(error_code) && (sending_sock == NULL || sending_sock->id() != peer_id)) { - Socket::SetFailed(peer_id); + maybe_block_server(error_code, c, c->_lb.get(), peer_id); } break; case CONNECTION_TYPE_POOLED: Review Comment: 有POOLED连接相关的改动吗? ########## src/brpc/controller.cpp: ########## @@ -719,6 +719,37 @@ inline bool does_error_affect_main_socket(int error_code) { error_code == EINVAL/*returned by connect "0.0.0.1"*/; } +inline void maybe_block_server(int error_code, Controller* cntl, SharedLoadBalancer* lb, SocketId sock) { + if (!does_error_affect_main_socket(error_code)) { Review Comment: 连接超时的情况可以优化吗? ########## src/brpc/controller.cpp: ########## @@ -1033,7 +1054,13 @@ void Controller::IssueRPC(int64_t start_realtime_us) { { start_realtime_us, true, has_request_code(), _request_code, _accessed }; LoadBalancer::SelectOut sel_out(&tmp_sock); - const int rc = _lb->SelectServer(sel_in, &sel_out); + int rc = _lb->SelectServer(sel_in, &sel_out); + if (rc == EHOSTDOWN) { + // If no server is available, include accessed server and try to SelectServer again + sel_in.excluded = NULL; Review Comment: 这样是不是就会选到期望要excluded的实例呢?这样合理吗? -- 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: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org