Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/brpc/socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -844,7 +848,6 @@ void Socket::BeforeRecycled() {
g_vars->channel_conn << -1;
}
}
_io_event.Reset();

#if BRPC_WITH_RDMA
if (_rdma_ep) {
Expand Down
8 changes: 3 additions & 5 deletions test/endpoint_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down