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 eb317584 Fix rdma remove consumer error (#2720)
eb317584 is described below

commit eb3175841300b05ce829e5375a7fa144ec930e65
Author: Bright Chen <chenguangmin...@foxmail.com>
AuthorDate: Thu Aug 8 18:10:37 2024 +0800

    Fix rdma remove consumer error (#2720)
---
 src/brpc/socket.cpp        | 5 ++++-
 test/endpoint_unittest.cpp | 8 +++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/brpc/socket.cpp b/src/brpc/socket.cpp
index a5398d1a..0fcad203 100644
--- a/src/brpc/socket.cpp
+++ b/src/brpc/socket.cpp
@@ -834,6 +834,10 @@ void Socket::BeforeRecycled() {
         sp->RemoveRefManually();
     }
 
+    // Reset `_io_event' at the end.
+    BRPC_SCOPE_EXIT {
+        _io_event.Reset();
+    };
     const int prev_fd = _fd.exchange(-1, butil::memory_order_relaxed);
     if (ValidFileDescriptor(prev_fd)) {
         if (_on_edge_triggered_events != NULL) {
@@ -844,7 +848,6 @@ void Socket::BeforeRecycled() {
             g_vars->channel_conn << -1;
         }
     }
-    _io_event.Reset();
 
 #if BRPC_WITH_RDMA
     if (_rdma_ep) {
diff --git a/test/endpoint_unittest.cpp b/test/endpoint_unittest.cpp
index afece46e..69d17919 100644
--- a/test/endpoint_unittest.cpp
+++ b/test/endpoint_unittest.cpp
@@ -551,7 +551,7 @@ void TestConnectInterruptImpl(bool timed) {
         int64_t connect_ms = butil::cpuwide_time_ms() - start_ms;
         LOG(INFO) << "Connect to " << ep << ", cost " << connect_ms << "ms";
 
-        timespec abstime = butil::milliseconds_from_now(connect_ms + 1);
+        timespec abstime = butil::milliseconds_from_now(connect_ms * 2);
         rc = butil::pthread_timed_connect(
             sockfd, (struct sockaddr*) &serv_addr,
             serv_addr_size, &abstime);
@@ -570,12 +570,10 @@ void* ConnectThread(void* arg) {
     return NULL;
 }
 
-void sig_handler(int sig) {
-    LOG(INFO) << "sig=" << sig;
-}
+void do_nothing_handler(int) {}
 
 void register_sigurg() {
-    signal(SIGURG, sig_handler);
+    signal(SIGURG, do_nothing_handler);
 }
 
 void TestConnectInterrupt(bool timed) {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to