This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new b8670f5b 修复rpc_channel_connection_count (#2580)
b8670f5b is described below

commit b8670f5b9b12a1f671d8b48d9372d6dbc97c359c
Author: yyweii <[email protected]>
AuthorDate: Mon Apr 1 10:13:43 2024 +0800

    修复rpc_channel_connection_count (#2580)
    
    * 修复rpc_channel_connection_count
    
    * Update health_check.cpp
---
 src/brpc/details/health_check.cpp | 3 ---
 src/brpc/socket.cpp               | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/brpc/details/health_check.cpp 
b/src/brpc/details/health_check.cpp
index ab838cc8..ea6e7874 100644
--- a/src/brpc/details/health_check.cpp
+++ b/src/brpc/details/health_check.cpp
@@ -206,9 +206,6 @@ bool HealthCheckTask::OnTriggeringTask(timespec* 
next_abstime) {
         hc = ptr->CheckHealth();
     }
     if (hc == 0) {
-        if (ptr->CreatedByConnect()) {
-            g_vars->channel_conn << -1;
-        }
         if (!FLAGS_health_check_path.empty()) {
             ptr->_ninflight_app_health_check.fetch_add(
                     1, butil::memory_order_relaxed);
diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp
index 1f9b2a2e..bf06a871 100644
--- a/src/brpc/socket.cpp
+++ b/src/brpc/socket.cpp
@@ -1369,9 +1369,6 @@ int Socket::CheckConnected(int sockfd) {
             << "Connected to " << remote_side()
             << " via fd=" << (int)sockfd << " SocketId=" << id()
             << " local_side=" << local_point;
-    if (CreatedByConnect()) {
-        g_vars->channel_conn << 1;
-    }
     // Doing SSL handshake after TCP connected
     return SSLHandshake(sockfd, false);
 }
@@ -1526,6 +1523,9 @@ void Socket::CheckConnectedAndKeepWrite(int fd, int err, 
void* data) {
     CHECK_GE(sockfd, 0);
     if (err == 0 && s->CheckConnected(sockfd) == 0
         && s->ResetFileDescriptor(sockfd) == 0) {
+        if (s->CreatedByConnect()) {
+            g_vars->channel_conn << 1;
+        }
         if (s->_app_connect) {
             s->_app_connect->StartConnect(req->socket, AfterAppConnected, req);
         } else {


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

Reply via email to