Uh oh!
There was an error while loading. Please reload this page.
fix(gamespy): run availability check, fix async DNS hostname lifetime - #3166
fix(gamespy): run availability check, fix async DNS hostname lifetime#3166sokie wants to merge 1 commit into
Conversation
PR Summary by QodoFix GameSpy online init: run availability check and stabilize async DNS hostname
AI Description
Diagram
High-Level Assessment
Files changed (2) |
Code Review by Qodo
1. Cancel causes counter underflow |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
8f276c3 to
a9804d3CompareSkyaero42
commented
Aug 18, 2026
Were these issues introduced by TheSuperHackers or were they always present? |
issue1: async DNS stuff, in #426, "[ZH] Fix constness errors for Zero Hour build" (1647f86, xezon, 2025-03-15).
issue2: GS availabilty doesn't seem to be anything introduced by you guys, might be just an old mismatch on Gamespy SDK tbh, wouldn't know. |
a9804d3 to
08d348eCompareUh oh!
There was an error while loading. Please reload this page.
08d348e to
1af5e89CompareUh oh!
There was an error while loading. Please reload this page.
xezon
left a comment
There was a problem hiding this comment.
This change has a lot of new comments but nothing that explains the fix at one place. I do not quite understand this change.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| if (availableCheckInProgress) | ||
| { | ||
| availableCheckResult = GSIAvailableCheckThink(); |
There was a problem hiding this comment.
I do not understand how this here works. I am unable to review this logic.
There was a problem hiding this comment.
and some comments I added as I was debugging this and left in, apologies.
Went through all comments and cleaned them up or tidied them up.
1af5e89 to
ac4c33aCompare
@xezon fair, and this is more of a gamespy SDK gap than your guys stuff. Every GameSpy SDK entry point opens with the same guard:
This is EA-era code meeting a post-EA SDK: the availability check was added to the SDK on 1.10.36, 10-29-2003 (its own changelog), after Zero Hour shipped, so the game legitimately never called an API that didn't exist. So this adds proper init support now. |
ac4c33a to
d05eb82CompareasyncGethostbyname() passes its argument to CreateThread and returns immediately, so the stack-local hostname introduced at both call sites in TheSuperHackers#426 was dead before the lookup thread read it; take const char* instead and pass the string literal directly, as the original code did. The backend availability check was never run, leaving __GSIACResult at GSIACWaiting, which makes peerInitialize() return null; release builds then dereference it in peerSetRoomWatchKeys() and report the fault as DISCONNECT_LOSTCON. Run the check as a fifth pre-online check and handle a null peer.
d05eb82 to
dc790d7Compare| { | ||
| Char hostname[] = "servserv.generals.ea.com"; | ||
| Int ret = asyncGethostbyname(hostname); | ||
| Int ret = asyncGethostbyname("servserv.generals.ea.com"); |
There was a problem hiding this comment.
Is this what the game uses to lookup the gamespy server?
If so it would probably be better to make it configurable.
There was a problem hiding this comment.
my library and most other patches redirect DNS anyway, but for long term I agree all gamespy DNS records should be configurable so game can be pointed to other services.
I think that is out of scope for this PR.
bobtista
commented
Aug 22, 2026
This is looking good to me. Could you add test results to the PR description eg:
Whatever new paths that CI can't test |
Hello! I'm the creator of the open source gamespy server https://github.com/sokie/kirov-server-emulator/tree/main
Users reported not being able to connect to Kirov on this build, after investigating found 2 issues stopping online to work:
asyncGethostbyname()passes its argument toCreateThreadand returns immediately, so the stack-localhostnameat both call sites is dead before the lookup thread reads it; make it static.__GSIACResult at GSIACWaiting, which makespeerInitialize()return null; release builds then dereference it inpeerSetRoomWatchKeys()and report the fault asDISCONNECT_LOSTCON. Run the check as a fifth pre-online check and handle a null peer.