Commit 79ab26ff authored by TousakaRin's avatar TousakaRin

fix code style, make the logic clearer

parent 89f462d1
......@@ -764,17 +764,9 @@ void Controller::Call::OnComplete(Controller* c, int error_code/*note*/,
c->stream_creator()->CleanupSocketForStream(
sending_sock.get(), c, error_code);
}
if (enable_circuit_breaker) {
if (!sending_sock) {
SocketUniquePtr sock;
if (Socket::Address(peer_id, &sock) == 0) {
sock->FeedbackCircuitBreaker(error_code,
butil::gettimeofday_us() - begin_time_us);
}
} else {
sending_sock->FeedbackCircuitBreaker(error_code,
butil::gettimeofday_us() - begin_time_us);
}
if (enable_circuit_breaker && sending_sock) {
sending_sock->FeedbackCircuitBreaker(error_code,
butil::gettimeofday_us() - begin_time_us);
}
// Release the `Socket' we used to send/receive data
sending_sock.reset(NULL);
......
......@@ -560,12 +560,12 @@ private:
void Reset();
void OnComplete(Controller* c, int error_code, bool responded);
int nretry; // sent in nretry-th retry.
bool need_feedback; // The LB needs feedback.
bool enable_circuit_breaker; // The channel enabled circuit_breaker
bool touched_by_stream_creator;
SocketId peer_id; // main server id
int64_t begin_time_us; // sent real time.
int nretry; // sent in nretry-th retry.
bool need_feedback; // The LB needs feedback.
bool enable_circuit_breaker; // The channel enabled circuit_breaker
bool touched_by_stream_creator;
SocketId peer_id; // main server id
int64_t begin_time_us; // sent real time.
// The actual `Socket' for sending RPC. It's socket id will be
// exactly the same as `peer_id' if `_connection_type' is
// CONNECTION_TYPE_SINGLE. Otherwise, it may be a temporary
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment