From abd612c15799f604e671e83dc7c410ed2b44185f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 25 Jun 2026 15:40:48 -0400 Subject: slop refactor --- internal/net/server.go | 22 ++++++++++------------ internal/net/server_test.go | 8 ++++---- 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'internal/net') diff --git a/internal/net/server.go b/internal/net/server.go index 5c98b62..9ae8532 100644 --- a/internal/net/server.go +++ b/internal/net/server.go @@ -8,7 +8,7 @@ import ( "net/http" "sync" - "thehouseoficarus/internal/action" + "thehouseoficarus/internal/behavior" "thehouseoficarus/internal/color" "thehouseoficarus/internal/config" "thehouseoficarus/internal/player" @@ -17,7 +17,7 @@ import ( type SessionState int const ( - StateAccountName SessionState = iota + StateAccountName SessionState = iota StatePassword StateNewAccountPass StateNewAccount @@ -60,20 +60,18 @@ type Session struct { PendingBackground bool Disconnecting bool DisconnectTicks int - Shop *action.ShopConfig + Shop *behavior.ShopConfig writeMu sync.Mutex } - - type Server struct { - config *config.Config - telnetLn net.Listener - telnetTLSLn net.Listener - httpServer *http.Server - httpsServer *http.Server - hub *Hub - handler func(*Session, string) + config *config.Config + telnetLn net.Listener + telnetTLSLn net.Listener + httpServer *http.Server + httpsServer *http.Server + hub *Hub + handler func(*Session, string) } type Hub struct { diff --git a/internal/net/server_test.go b/internal/net/server_test.go index fca5528..b106c53 100644 --- a/internal/net/server_test.go +++ b/internal/net/server_test.go @@ -38,10 +38,10 @@ func TestHubConcurrency(t *testing.T) { type testConn struct{ data []byte } -func (c *testConn) ReadMessage() (string, error) { return "", nil } -func (c *testConn) Write(b []byte) (int, error) { c.data = append(c.data, b...); return len(b), nil } -func (c *testConn) Close() error { return nil } -func (c *testConn) SetEcho(bool) error { return nil } +func (c *testConn) ReadMessage() (string, error) { return "", nil } +func (c *testConn) Write(b []byte) (int, error) { c.data = append(c.data, b...); return len(b), nil } +func (c *testConn) Close() error { return nil } +func (c *testConn) SetEcho(bool) error { return nil } func TestSessionWriteConcurrency(t *testing.T) { conn := &testConn{} -- cgit v1.2.3