Skip to content

Outcome type defines 'timeout' reason but it's never set #4

@dennisthemenacing

Description

@dennisthemenacing

The type in defines as a valid game-ending reason:

export type Outcome = {
   winner?: Color;
   reason: 'checkmate' | 'resignation' | 'timeout' | 'draw' | 'stalemate' | 'insufficient_material' | 'threefold_repetition';
}

However, looking through the codebase, is never actually set anywhere. The disconnect handler in sets a 5-second reconnect timer, but when that timer fires it calls directly without ever setting an outcome with reason .

A outcome would be appropriate when a player disconnects and does not reconnect within the grace period. This would provide a cleaner game record than silently erasing the game.

To fix this, the disconnect handler's reconnect timer should set before erasing the game, similar to how handles it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions