Windows socket implementation is, as usual, broken in many ways.
This includes `setsockopt` failing to set `TCP_NODELAY` if the socket is
still in a connecting state.
This also means we need to keep polling the IP resolver until the socket
reaches the CONNECTED state (so it can set the TCP_NODELAY after the
connection is successful).
Godot supports sending messages to "all but one peer" by sending a
packet with a negative target (the negated ID of the excluded peer).
The relay protocol was incorrectly interpreting the values and relaying
the message to the wrong peers.
This issue only affected "send_bytes" since the other subsystem (RPC
and replication) "resolves" the correct IDs client-side (to match
visibility information).
When multiple clients are connected, and the server is using the relay
sub-protocol, it might happen that a client disconnects while a packet
sent to it from another peer is still in transit.
In that case, when the packet reaches the server for relaying, it used
to generate an error (as the destination client did no longer exists).
This commit changes check to suppress the error message while still
skipping the packet.
Cleaning up remote NodePath cache is not trivial since the visibility
API allows for certain nodes to be despawned (and re-spawned) on some
peers while being retained in the authority.
This means that from the server point of view, the node has not changed,
and the path simplification protocol won't be run again after
respawning.
While we can track this information for synchronizers via the
replication API, we can't easily track this information for potential
child nodes that use RPCs (I'm convinced it is doable, but we need to
track the whole dependency tree which would require some more complex
refactoring).
This commit partially reverts some of the cache cleanup logic to always
retain remote IDs, and adds a NodePath lookup fallback when the ObjectID
is invalid.
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.
This switches to 64-bit integers in select locations of the Image
class, so that image resolutions of 16384×16384 (used by
lightmap texture arrays) can be used properly. Values that are larger
should also work.
VRAM compression is also supported, although most VRAM-compressed
formats are limited to individual slices of 16384×16384. WebP
is limited to 16383×16383 due to format limitations.