refactor(network): Remove legacy Send Delay - #3007
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/GameNetwork/FirewallHelper.h | Removes the FIREWALL_TYPE_NETGEAR_BUG enum value and both isNetgear() overloads; straightforward dead-code removal. |
| Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp | Removes all m_firewallSendDelay / FIREWALL_TYPE_NETGEAR_BUG references and dead #if (0) block; clean removal with no behavioral gaps. |
| Core/GameEngine/Source/GameNetwork/NAT.cpp | Removes Netgear pairing loop and probe-delay logic; the connectionAssigned[i] == TRUE guard at the top of the remaining assignment loop is now dead code (always false), but harmless. |
| Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp | GUI hiding of Send Delay checkbox is guarded by #if ENABLE_GUI_HACKS, but all save/load logic was removed unconditionally — leaving the checkbox visible and enabled but non-functional in builds without that macro. |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp | Same ENABLE_GUI_HACKS asymmetry as the Generals variant — checkbox remains visible and enabled but non-functional in builds without the macro. |
Sequence Diagram
sequenceDiagram
participant UI as Options Menu
participant GP as GlobalData
participant FH as FirewallHelper
participant NAT as NAT
note over UI,NAT: Before (with SendDelay / Netgear path)
UI->>GP: "m_firewallSendDelay = getSendDelay()"
GP->>FH: detectionBeginUpdate sets FIREWALL_TYPE_NETGEAR_BUG
FH->>NAT: establishConnectionPaths (Netgear pairing loop)
NAT->>NAT: "doThisConnectionRound sets m_timeTillNextSend = -1"
NAT->>NAT: gotMangledPort waits for m_beenProbed before probing
note over UI,NAT: After (this PR)
UI-->>GP: (no SendDelay read)
GP->>FH: detectionBeginUpdate (no Netgear branch)
FH->>NAT: establishConnectionPaths (simple slot to node assignment)
NAT->>NAT: doThisConnectionRound probes immediately
NAT->>NAT: gotMangledPort always calls sendAProbe()
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp:955-960
**Checkbox hidden only under `ENABLE_GUI_HACKS`, but save/load removed unconditionally**
The "Send Delay" checkbox is hidden inside `#if ENABLE_GUI_HACKS`, but every save (`saveOptions`) and load (`OptionsMenuInit` → `GadgetCheckBoxSetChecked`) reference was removed unconditionally. In any build where `ENABLE_GUI_HACKS` is not defined, the checkbox remains visible and enabled in the Options GUI — users can toggle it freely — but the state is never persisted and has no effect. The same asymmetry is present in `GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp`.
Reviews (3): Last reviewed commit: "refactor(network): Put Send Delay check ..." | Re-trigger Greptile
|
Left one question, otherwise this looks good |
What this code did:
The
SendDelaysetting (m_firewallSendDelay) enabled a specialized NAT traversal mode (FIREWALL_TYPE_NETGEAR_BUG) inFirewallHelper.cppandNAT.cpp:m_timeTillNextSend = -1) on outbound UDP STUN/probe packets sent to peer players.NAT::establishConnectionPaths(), it rearranged player connection slots into special pairs for nodes identified as having the Netgear NAT bug.NAT::probed()andNAT::gotMangledPort(), it blocked local clients from sending reciprocal NAT probes until the remote peer probed them first.SendDelay = yes/noinOptions.ini.Background & Reason for Removal:
SendDelay = noinOptions.ini. In reality, it had zero effect on in-game performance.NAT.cpp, removes dead code acrossFirewallHelper,OptionPreferences, andGlobalData, and hides the obsolete setting from the Options GUI.