2.2 KiB
GSP Windows Agent Process Management
Workspace reference: GSP-WORKSPACE.md
The Windows agent manages customer servers through the Cygwin runtime and the OGP Perl agent.
Current model
OGP64is the Cygwin root for the maintained launcher- process state is tracked through the agent runtime and PID files
- configured port validation is handled by
server_statusinOGP64/OGP/ogp_agent.pl - manual startup and shutdown are handled by the root batch scripts
- Windows-specific user and service assumptions belong here, not in the Panel
Important files
OGP64/agent_start.batOGP64/agent_stop.batOGP64/OGP/ogp_agent.plOGP64/OGP/Cfg/
Rule
Keep startup and stop behavior visible and explicit. Failures should be reported in the same console when launched manually.
Port validation
Detailed status validation design:
Lifecycle tracking
The Windows agent now tracks per-home runtime metadata under:
OGP64/OGP/runtime_status/pid-<home_id>.kv
Tracked fields include PID/session information used to stop the right process reliably:
screen_pidwindows_pidgame_pidipport
Stop escalation flow
When stop is requested, the agent now:
- marks status hint as
STOPPING - removes startup flag for
<ip>-<port> - kills tracked PIDs (
screen_pid,windows_pid,game_pid) if present - kills managed screen session
- checks if the game port is still listening and kills the owning PID
- verifies stop success (no managed session, no tracked running PID, no listening game port)
- writes status hint
STOPPEDonly after verification passes
The agent no longer creates or reads SERVER_STOPPED/Server_Stopped marker files for lifecycle control.
Autorestart loop control now uses agent-owned runtime status hints (STARTING/STOPPING/STOPPED) instead of game-home marker files.
Restart behavior
Restart remains stop-first and now guards against duplicates:
- stop is attempted first
- waits 60 seconds
- verifies old instance is stopped before starting again
- returns stop failure if the old process/port is still active