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
|
8f276c3 to
a9804d3
Compare
|
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
08d348e
Compare
| s_asyncDNSLookupInProgress = TRUE; | ||
| Char hostname[] = "servserv.generals.ea.com"; | ||
| // static: see HTTPThinkWrapper(). | ||
| static Char hostname[] = "servserv.generals.ea.com"; |
There was a problem hiding this comment.
Hmm right I did not pay attention to this back in the day.
Instead, can we perhaps make asyncGethostbyname take const char* so that we can pass the string pointer again? But that requires a const_cast in it perhaps.
There was a problem hiding this comment.
@xezon since this is the first time I'm touching this codebase I just wanted to keep the PR self-contained ( and this basically restores behavior to the previous EA one ).
Happy to expand this if you prefer.
There was a problem hiding this comment.
@xezon done, the blast radius was smaller than I thought!
asyncGethostbyname() 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.
08d348e to
1af5e89
Compare
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.