diff options
Diffstat (limited to 'internal/net/conn.go')
| -rw-r--r-- | internal/net/conn.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/net/conn.go b/internal/net/conn.go index 2fff0bc..6d78d8f 100644 --- a/internal/net/conn.go +++ b/internal/net/conn.go @@ -6,12 +6,18 @@ import ( "io" "net" "strings" + "time" ) type Conn interface { ReadMessage() (string, error) io.Writer io.Closer + // SetWriteDeadline is optional for transports: sessions that support it + // enforce per-write deadlines so a stalled peer surfaces as a timeout + // instead of a hung writer goroutine. Implementations without deadline + // support return nil (deadlines are best-effort). + SetWriteDeadline(t time.Time) error SetEcho(bool) error } @@ -70,6 +76,10 @@ func (t *tcpConn) Write(b []byte) (int, error) { return t.conn.Write(b) } +func (t *tcpConn) SetWriteDeadline(ts time.Time) error { + return t.conn.SetWriteDeadline(ts) +} + func (t *tcpConn) Close() error { return t.conn.Close() } |
