We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d22fa17 commit 71732b3Copy full SHA for 71732b3
src/brpc/socket_map.cpp
@@ -295,8 +295,10 @@ void SocketMap::RemoveInternal(const SocketMapKey& key,
295
const int defer_close_second = _options.defer_close_second_dynamic ?
296
*_options.defer_close_second_dynamic
297
: _options.defer_close_second;
298
- if (!remove_orphan && defer_close_second > 0) {
299
- // Start count down on this Socket
+ if (!remove_orphan && defer_close_second > 0
+ && sc->no_ref_us <= (sc->socket->last_active_time_us() + defer_close_second * 1000000L)) {
300
+ // Start count down on this Socket. If the socket has been idle for
301
+ // longer than defer_close_second already, close it immediately.
302
sc->no_ref_us = butil::cpuwide_time_us();
303
} else {
304
Socket* const s = sc->socket;
0 commit comments