mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-10-03 20:37:07 +00:00
fix(games): reject duplicate queue entries (#117)
* test(games): reproduce duplicate queue deadlock * fix(games): reject duplicate queue entries
This commit is contained in:
parent
be75744248
commit
5a1f5d90db
4 changed files with 56 additions and 2 deletions
|
|
@ -70,6 +70,9 @@ func (a *app) handleGame(s ssh.Session) {
|
|||
case errors.Is(err, games.ErrNoOpponent):
|
||||
_ = conn.Send(errEnvelope("no opponent found — try again later"))
|
||||
_ = s.Exit(1)
|
||||
case errors.Is(err, games.ErrAlreadyQueued):
|
||||
_ = conn.Send(errEnvelope("this account is already queued for that game"))
|
||||
_ = s.Exit(1)
|
||||
case err != nil && !errors.Is(err, games.ErrUnknownGame):
|
||||
// Unknown-game is already handled above; anything else is a wait abort
|
||||
// (e.g. the agent disconnected) and needs no message.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue