diff options
| author | historia <[not public]> | 2026-06-25 15:40:48 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-25 15:40:48 -0400 |
| commit | abd612c15799f604e671e83dc7c410ed2b44185f (patch) | |
| tree | 0597ca92350de73aac2a7cf26b2f2d6595dac0cc /internal/net | |
| parent | 2725e2927a1595c7b100d942d1f14146252adeb7 (diff) | |
| download | thehouseoficarus-abd612c15799f604e671e83dc7c410ed2b44185f.tar.gz | |
slop refactor
Diffstat (limited to 'internal/net')
| -rw-r--r-- | internal/net/server.go | 22 | ||||
| -rw-r--r-- | internal/net/server_test.go | 8 |
2 files changed, 14 insertions, 16 deletions
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{} |
