aboutsummaryrefslogtreecommitdiff
path: root/internal/net/conn.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/net/conn.go')
-rw-r--r--internal/net/conn.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/internal/net/conn.go b/internal/net/conn.go
index a4be83a..d8c867e 100644
--- a/internal/net/conn.go
+++ b/internal/net/conn.go
@@ -79,7 +79,11 @@ func (t *tcpConn) ReadMessage() (string, error) {
text = stripIAC(text)
text = truncateLine(text, maxLineLength)
if t.echoOff.Load() {
- t.conn.Write([]byte("\r\n"))
+ // Refresh the write deadline: the writer goroutine may have left a
+ // stale deadline in the past, which would silently drop this echo on
+ // an idle connection.
+ _ = t.conn.SetWriteDeadline(time.Now().Add(writeDeadline))
+ _, _ = t.conn.Write([]byte("\r\n"))
}
return text, nil
}