read heartbeats from queueing players

This commit is contained in:
Branden J Brown 2024-02-02 20:48:45 -06:00
parent af9b287252
commit 9beb0c989e
1 changed files with 8 additions and 0 deletions

View File

@ -197,6 +197,14 @@ func (s *Server) Queue(w http.ResponseWriter, r *http.Request) {
func (s *Server) joinAndServe(p person) { func (s *Server) joinAndServe(p person) {
slog.Debug("joining", "player", p.id) slog.Debug("joining", "player", p.id)
ctx, stop := context.WithTimeoutCause(context.Background(), 10*time.Minute, errQueueEmpty) ctx, stop := context.WithTimeoutCause(context.Background(), 10*time.Minute, errQueueEmpty)
go func() {
for {
_, _, err := p.conn.Read(ctx)
if err != nil {
return
}
}
}()
id, chall, deal := s.l.Queue(ctx, p.id) id, chall, deal := s.l.Queue(ctx, p.id)
stop() stop()
if id == (lobby.GameID{}) { if id == (lobby.GameID{}) {