-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WebSocket] Ensure TCP_NODELAY
is always set
#94618
Conversation
Unlike what mentioned in #86234 (comment) , I decided always set the no delay option. That was the original intent, and is in line with most implementations: https://bugzilla.mozilla.org/show_bug.cgi?id=542401 https://issues.chromium.org/issues/41152920 https://bugs.webkit.org/show_bug.cgi?id=102079 It's worth noting that languages like go, defaults to disable the Nagle's algorithm even if most OSes would otherwise have different default (see here). We should evaluate if we want to do something similar in Godot's socket implementation (in its own proposal/PR). |
TCP_NODELAY
is always set
So IIUC this fixes the pre-existing docs for WebSocketPeer? As they mention "no delay" is the default.
BTW I notice a typo in "underling" (should be "underlying"), worth fixing in this PR while at it. |
Almost all WebSocket implementations (including all major browsers) disable Nagle's algorithm to favor low latency over packet overhead. This was also the case in Godot 3.x, while in Godot 4.0 this was only being done for clients and wasn't even always working due to a bug. This commit fixes the aforementioned bug, and forces TCP_NODELAY when accepting a stream as a server.
Indeed, I didn't notice it was even in the documentation.
I've added the fix for the typo. |
Thanks! |
Almost all WebSocket implementations (including all major browsers) disable Nagle's algorithm to favor low latency over packet overhead.
This was also the case in Godot 3.x, while in Godot 4.0 this was only being done for clients and wasn't even always working due to a bug.
This commit fixes the aforementioned bug, and forces TCP_NODELAY when accepting a stream as a server.
Fixes #86234