From b89a4638f29918777a4087555e5d95d85b8fec7a Mon Sep 17 00:00:00 2001 From: Antonio Mika Date: Mon, 9 Oct 2023 14:48:00 -0400 Subject: [PATCH] Set conn deadline to both reads and writes (#281) --- utils/conn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/conn.go b/utils/conn.go index 45b1df1..6927c94 100644 --- a/utils/conn.go +++ b/utils/conn.go @@ -184,7 +184,7 @@ type IdleTimeoutConn struct { // Read is needed to implement the reader part. func (i IdleTimeoutConn) Read(buf []byte) (int, error) { - err := i.Conn.SetReadDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout"))) + err := i.Conn.SetDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout"))) if err != nil { return 0, err } @@ -194,7 +194,7 @@ func (i IdleTimeoutConn) Read(buf []byte) (int, error) { // Write is needed to implement the writer part. func (i IdleTimeoutConn) Write(buf []byte) (int, error) { - err := i.Conn.SetWriteDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout"))) + err := i.Conn.SetDeadline(time.Now().Add(viper.GetDuration("idle-connection-timeout"))) if err != nil { return 0, err }