aboutsummaryrefslogtreecommitdiff
path: root/internal/net/conn.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-15 15:35:52 -0400
committerhistoria <[not public]>2026-09-15 15:35:52 -0400
commit0b0b25222b3131ada79ff78c28eb8bf07d977deb (patch)
tree2ceaef5203595044f66a8f00064cd8e017f8f48d /internal/net/conn.go
parent396c3facb8287b9a34076cae8f3d7b300d366d99 (diff)
downloadthehouseoficarus-0b0b25222b3131ada79ff78c28eb8bf07d977deb.tar.gz
feat: single-owner game state, transactional lifecycle, durable money on server stop
Diffstat (limited to 'internal/net/conn.go')
-rw-r--r--internal/net/conn.go10
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()
}