Repository navigation
bugfix(network): Close sockets that fail to bind - #3488
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughWhen ChangesUDP bind failure cleanup
Priority: ⬆️ High Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: 🟡 Moderate · up to A POSIX bind failure may stop retries while leaving transport or spare-socket setup with a closed socket, disrupting UDP networking. Correct the bind failure status before merging. Pre-merge checks ·
|
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a6e9ab6b-2ae5-4874-b075-3ea8913b2f42
📒 Files selected for processing (2)
Core/GameEngine/Source/GameNetwork/FirewallHelper.cppCore/GameEngine/Source/GameNetwork/udp.cpp
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.
21f6de1 to
95cbed3
Compare
UDP::Bindopens a new socket on every call and never closed it whenbindfailed.Transport::initretriesBindfor a full second, so every attempt on a busy port leaks a socket. With the LAN lobby port 8086 already taken, for example by a second game on the same PC, I measured about 100k sockets and 70 MB of kernel pool per second. Entering the lobby runs that loop twice.FirewallHelperClass::openSpareSocketleft a spare socket that failed to bind in its slot, and the next call overwrote it.Both now close the socket on failure.