Skip to content

feat(online): Keep the WebSocket sending under backpressure and pick a working service route - #645

Open
tintinhamans wants to merge 13 commits into
GeneralsOnlineDevelopmentTeam:mainfrom
tintinhamans:arctic/go/feat/service-endpoint-selection
Open

tintinhamans wants to merge 13 commits into
GeneralsOnlineDevelopmentTeam:mainfrom
tintinhamans:arctic/go/feat/service-endpoint-selection

Conversation

@tintinhamans

@tintinhamans tintinhamans commented Oct 23, 2026 •

Copy link
Copy Markdown

Merge after #648. Includes #644, closed as folded into this PR.

WebSocket::Tick sent the whole outbound queue and only logged failures, so a partial send or CURLE_AGAIN lost the rest of a frame and the next message went out in the middle of it. The game also talked to a single API host, so a player whose route to it was blocked could not log in.

The send queue now keeps the offset into a partly sent message and is capped, a tick reads up to 64 queued frames, heartbeats no longer pile up, and any send or receive error reconnects. The game tries api.playgenerals.online, then api-ru.playgenerals.online, through the anonymous VersionManifest request (6 s each) and remembers the one that worked. A 401 or 403 stops the search, the route is reused for 30 s, a signed in session keeps its route, and dev and test have one route. Requests and the WSS address stay on the selected route, the token is only sent there, and redirects are no longer followed.

settings.json gets network.server.mode (automatic, the only value here, custom comes with #646) and network.last_route, the host of the last working route. The old use_alternative_endpoint is read once as the api-ru host, and network.http_version is dropped. Invalid values are reset to their default and written back. Unknown keys are kept on save, but data_packs is replaced wholesale by what the client holds, and a settings file that could not be read is no longer overwritten with defaults.

Response bodies, login codes and websocket payloads are only logged with debug.verbose_logging. _DEBUG builds skip TLS verification for local service testing, release always verifies.

No service changes needed. Tested: z_generals builds, route policy checks, a 120 s two client match with 25% TCP loss on the API/WSS port (no reconnect, no send error). Not tested: a real fallback to the alternative route.

@tintinhamans
tintinhamans force-pushed the arctic/go/feat/service-endpoint-selection branch 2 times, most recently from e1f4a9c to 5b878e7 Compare October 24, 2026 20:42
@tintinhamans tintinhamans changed the title feat(online): Pick a working service route automatically feat(online): Keep the WebSocket sending under backpressure and pick a working service route Oct 24, 2026
xezon added 7 commits October 24, 2026 23:10
…ile::getFileInfo(), StdBIGFile::getFileInfo() (TheSuperHackers#3415)

(cherry picked from commit b805c12)
…File (TheSuperHackers#3505)

Both classes are identical apart from their name and contain no platform specific code.
Nothing in them depends on the BIG format either: they open a file from an offset and a
size inside the archive file. ArchiveFile takes over their functions and is no longer an
abstract class.

(cherry picked from commit 52a777a)
…ystem into BIGFileSystem (TheSuperHackers#3505)

Both classes are identical apart from their name and go through the local file system
for all file access. The one class that remains sits next to ArchiveFileSystem in
Core/GameEngine.

(cherry picked from commit e4b4d1e)
…e loadBigFilesFromDirectory (TheSuperHackers#3505)

loadMods refers to BIG files, which nothing else in ArchiveFileSystem does. It becomes a
virtual function that BIGFileSystem implements. loadBigFilesFromDirectory is renamed to
loadArchiveFilesFromDirectory, because the base class is not tied to one archive format.

(cherry picked from commit f299561)
@tintinhamans
tintinhamans force-pushed the arctic/go/feat/service-endpoint-selection branch 3 times, most recently from 733469a to 350a36a Compare October 25, 2026 05:20
@tintinhamans
tintinhamans force-pushed the arctic/go/feat/service-endpoint-selection branch from 350a36a to 20e5385 Compare October 25, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants