From c84a9944356f590d90d819d652bdf1349ebacd40 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 5 Oct 2026 06:03:49 -0400 Subject: feat: prediction exchange with live polymarket data --- internal/net/server.go | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'internal/net/server.go') diff --git a/internal/net/server.go b/internal/net/server.go index d983161..5cf7310 100644 --- a/internal/net/server.go +++ b/internal/net/server.go @@ -66,10 +66,22 @@ type Session struct { PendingUndigDir string PendingUndigRoom int // Casino spectator preferences are session-local, owner-goroutine only. - CasinoWatchRoom int - CasinoWatchTable string - promptVisible bool - writeMu sync.Mutex + PredictionActive bool + PredictionEpoch uint64 + PredictionCancel context.CancelFunc + PredictionSelected string + PredictionScreen string + PredictionBoardPage int + PredictionShowHints bool + PredictionUnavailable bool + PredictionBusy bool + PredictionIDs []string + PredictionPage int + PredictionSearch string + CasinoWatchRoom int + CasinoWatchTable string + promptVisible bool + writeMu sync.Mutex // Disconnect bookkeeping is written by the connection goroutine that // discovered the dead transport (Hub.Remove's deferred path) and read @@ -506,6 +518,14 @@ func (h *Hub) EnterRoom(s *Session, roomID int) { // room stops it, so leaving and returning does not silently resume it. s.CasinoWatchRoom = 0 s.CasinoWatchTable = "" + s.PredictionActive = false + if s.PredictionCancel != nil { + s.PredictionCancel() + s.PredictionCancel = nil + } + s.PredictionEpoch++ + s.PredictionBusy = false + s.PredictionSelected = "" h.leaveRoomLocked(s) if h.rooms[roomID] == nil { h.rooms[roomID] = make(map[*Session]bool) -- cgit v1.2.3