From 0b0b25222b3131ada79ff78c28eb8bf07d977deb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Tue, 15 Sep 2026 15:35:52 -0400 Subject: feat: single-owner game state, transactional lifecycle, durable money on server stop --- internal/net/conn.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/net/conn.go') 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() } -- cgit v1.2.3