From c454e36f1673c0c69e2801c52ca1fc89a62fb79d Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 24 Aug 2020 16:41:43 +0000 Subject: [PATCH 1/2] Do not lose original inactivity timeout on disable --- iocore/net/P_UnixNet.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index 2c74a3ed2df..041b75afee3 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -548,7 +548,8 @@ static inline void read_disable(NetHandler *nh, NetEvent *ne) { if (!ne->write.enabled) { - ne->set_inactivity_timeout(0); + // Don't reset the inactivity_timeout_in, so it we be there next time we reset + ne->next_inactivity_timeout_at = 0; Debug("socket", "read_disable updating inactivity_at %" PRId64 ", NetEvent=%p", ne->next_inactivity_timeout_at, ne); } ne->read.enabled = 0; @@ -569,7 +570,8 @@ static inline void write_disable(NetHandler *nh, NetEvent *ne) { if (!ne->read.enabled) { - ne->set_inactivity_timeout(0); + // Don't reset the inactivity_timeout_in, so it we be there next time we reset + ne->next_inactivity_timeout_at = 0; Debug("socket", "write_disable updating inactivity_at %" PRId64 ", NetEvent=%p", ne->next_inactivity_timeout_at, ne); } ne->write.enabled = 0; From 785805b8a5ac95010b212a2e4caed407b3a9b105 Mon Sep 17 00:00:00 2001 From: Susan Hinrichs Date: Mon, 14 Sep 2020 15:50:53 +0000 Subject: [PATCH 2/2] Improve comment --- iocore/net/P_UnixNet.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index 041b75afee3..cd872194aa7 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -548,7 +548,8 @@ static inline void read_disable(NetHandler *nh, NetEvent *ne) { if (!ne->write.enabled) { - // Don't reset the inactivity_timeout_in, so it we be there next time we reset + // Clear the next scheduled inactivity time, but don't clear inactivity_timeout_in, + // so the current timeout is used when the NetEvent is reenabled and not the default inactivity timeout ne->next_inactivity_timeout_at = 0; Debug("socket", "read_disable updating inactivity_at %" PRId64 ", NetEvent=%p", ne->next_inactivity_timeout_at, ne); } @@ -570,7 +571,8 @@ static inline void write_disable(NetHandler *nh, NetEvent *ne) { if (!ne->read.enabled) { - // Don't reset the inactivity_timeout_in, so it we be there next time we reset + // Clear the next scheduled inactivity time, but don't clear inactivity_timeout_in, + // so the current timeout is used when the NetEvent is reenabled and not the default inactivity timeout ne->next_inactivity_timeout_at = 0; Debug("socket", "write_disable updating inactivity_at %" PRId64 ", NetEvent=%p", ne->next_inactivity_timeout_at, ne); }