303 Commits

Author SHA1 Message Date
Danil Alexeev 32d1f518fa Improve editor-only class checking 2026-03-25 17:07:39 +03:00
Lukas Tenbrink 05c33acbb1 Make memnew(RefCounted) return Ref, to force callers to take ownership of it through a reference. 2026-03-18 20:34:08 +01:00
StarryWorm 3cb2d376f8 Get rid of all unnecessary class_db.h includers 2026-03-04 17:40:05 -05:00
Rémi Verschelde f332faf46b Explicitly include core/os/os.h where used 2026-03-04 09:54:10 +01:00
Thaddeus Crews e380a41752 Style: Add class_db.h includes explicitly 2026-02-26 15:50:28 -06:00
Lukas Tenbrink 0ea5ece984 Move binary math functions to Math namespace in math_funcs_binary header. 2026-02-17 12:24:35 +01:00
Lukas Tenbrink c5df0cb82b Don't right-align escaped newlines, e.g. for #define. This has previously led to long diffs in the commit history. 2026-02-04 19:31:28 +01:00
Thaddeus Crews 3c341ffcab Merge pull request #104433 from marcosc90/perf-wasm-ws
[Web] Optimize WebSocket send by replacing per-byte heap reads with heapSlice
2026-01-28 12:27:14 -06:00
Micky be0c68845e Fix miscellaneous oddities around the class reference (part 6) 2025-11-25 21:20:57 +01:00
Thaddeus Crews b17aa3343a Revert "SCons: Add CPPEXTPATH for external includes" 2025-10-06 13:09:22 -05:00
Aaron Franke ac2e01684c Use const ref parameters in the Web modules 2025-09-28 08:13:13 -07:00
Edward Moulsdale e366471fdc Add GDSOFTCLASS to deeper inheritors of Object 2025-09-24 19:15:56 +01:00
A Thousand Ships f11aff3841 Editor: Restructure editor code
Moving various editor files into sub folders to reduce clutter
2025-07-04 18:18:22 +02:00
kobewi 13f642d959 Replace XML codeblock spaces with tabs 2025-06-06 14:35:38 +02:00
Haoyu Qiu 1e82bafa3a Remove redundant info on the enum types used 2025-06-04 08:21:47 +08:00
Thaddeus Crews 7a3d2f6779 Merge pull request #106606 from aaronfranke/pow2_64
Add 64-bit versions of core power of 2 functions
2025-06-02 18:51:56 -05:00
Aaron Franke f6f1df7d73 Add 64-bit versions of core power of 2 functions 2025-06-01 23:11:12 -07:00
Marcos Casagrande f05b22c53e Web: Avoid extra copy when encoding string in WebSocket _onmessage 2025-04-19 17:48:30 +02:00
Thaddeus Crews 1f56d96cf2 Merge pull request #104893 from Repiteo/scons/external-includes-alt
SCons: Add `CPPEXTPATH` for external includes
2025-04-02 07:48:03 -05:00
Thaddeus Crews f25fc34439 SCons: Add CPPEXTPATH for external includes 2025-04-02 07:29:08 -05:00
Yufeng Ying 4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +08:00
Lukas Tenbrink ffa6ef220b Use append_ instead of parse_ for String methods. 2025-03-27 17:51:02 +01:00
Thaddeus Crews f09ee0171a Style: Begin integrating simple .clangd fixes 2025-03-22 13:24:35 -05:00
Marcos Casagrande 7affb89f65 Web: Optimize WebSocket send by replacing per-byte heap reads with heapSlice 2025-03-21 14:32:00 +01:00
Rémi Verschelde 2fa721b1bc Merge pull request #104127 from Ivorforce/360-noclip
Remove `String` clipping constructors.
2025-03-19 12:27:10 +01:00
Lukas Tenbrink a23f630781 Remove String clipping constructors.
Callers should instead call constructors with explicit encoding names, with known length `Span`.
2025-03-15 12:34:44 +01:00
kobewi 7cb2fb189a Remove TOOLS_ENABLED checks from editor/ 2025-03-14 18:13:16 +01:00
Thaddeus Crews 324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
Fabio Alessandrelli a2f5eb9cf0 [WS] Fix wslay multi-frame message parsing (again)
We incorrectly assumed that the `payload_length` in the recv start
callback of wslay was the final message size, but according to the
WebSocket  protocol, the payload length always refers to the current
frame's payload size.

The protocol, in fact, do not include a "message payload" length on
purpose to allow sending messages of unknown size without forcing the
sender to buffer the whole message (RFC6455 Section 5.4).

This means a receiving peer has no way to know beforehand how long a
message will be, and needs instead to keep track of the length of each
frame until the FIN one is received to properly reconstruct the message
at the end.
2025-01-28 16:26:11 +01:00
Fabio Alessandrelli 81181c5941 [WS] Fix peer stuck in CLOSING state
This was due by the buffer being cleared on close (including in closing
state) preventing further reads.

This commit changes the close logic to only clear the buffer when the
peer connection has been fully closed (acknowledged by the other end, or
closed due to a "broken" connection).
2025-01-18 16:01:40 +01:00
Adam Scott 33e16435f5 Replace some problematic uses of String::num to String::num_int64 2025-01-15 12:51:51 -05:00
Rémi Verschelde 7dd14207dc Merge pull request #100631 from Faless/fix/wslay_frame_end_not_fin
[WS] Fix wslay multi-frame message parsing
2025-01-03 00:48:47 +01:00
Yufeng Ying 33817b186f Remove unused header in drivers and modules.
Co-authored-by: Thaddeus Crews <repiteo@outlook.com>
2024-12-24 00:40:47 +08:00
Fabio Alessandrelli d798068a08 [WS] Fix wslay multi-frame message parsing
The wslay library, somehow unintuitively, will call the frame recv end
callback for control frames.

This has the side effect that while receiving a long message (i.e. a
multi-frame message), if a control frame (e.g. a ping or pong) is
received it may seem that a FIN frame has been received, resulting in
the current code truncating the message.

To avoid this, this commit now ignores the frame recv end callback, and
instead rely on the msg recv callback where we can check the opcode, and
is guaranteed to be called only when the FIN frame is received for text
and binary frames.
2024-12-20 12:44:59 +01:00
Fabio Alessandrelli 95401f0753 [WebSocket] Clarify that connect_to_url is non-blocking 2024-11-27 13:31:28 +01:00
Fabio Alessandrelli 3114bda4e1 [WS] Implement wslay unbuffered message parsing
Ensure we never read more than we can store during poll.

Raise default max packets to 4096 to maintain the same performance for
the first 2048 packets.
2024-11-12 17:19:39 +01:00
Thaddeus Crews caff0ff591 Merge pull request #97913 from Faless/fix/websocket_closing_transition
[WS] Detect disconnection due to protocol errors
2024-11-12 09:28:15 -06:00
Fabio Alessandrelli e2d62f8618 [WebSocket] Add optional heartbeat via "ping" control frames.
Has no effect in Web exports since the browsers do not expose a way to
send ping control frames.
2024-11-07 15:18:46 +01:00
Fabio Alessandrelli 6cdfc8c9fe [WS] Detect disconnection due to protocol errors
When wslay receives a message that is too big or cause a protocol error,
it automatically sends a close request to the remote peer but it also
completely stop calling the receive callback resulting in the state
being "stuck" as CONNECTED (even if both client and server have
disconnected).

We now check if we sent a close message and reading has been disabled to
manually transition to the "closed" state with the proper reason.
2024-11-04 11:20:30 +01:00
Adam Scott 0d350e7108 Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
Haoyu Qiu 6516ca6b11 Parse fragment from URL 2024-09-27 19:42:30 +08:00
Thaddeus Crews 9f9ee0c813 SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 -05:00
Daylily-Zeleen 3d575801ce Allow ClassDB to create a Object without postinitialization for GDExtension. 2024-08-20 20:19:02 +08:00
Fabio Alessandrelli 7f610a2c6e [WS] Fix set_no_delay on Windows
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).
2024-08-07 09:47:00 +02:00
Rémi Verschelde 2add44c0dc Merge pull request #94168 from Faless/net/wsl_peer_reuse
[WebSocket] Allow reusing closing and closed peers
2024-08-01 00:06:26 +02:00
Fabio Alessandrelli d65e7aab76 [WebSocket] Ensure TCP_NODELAY is always set
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.
2024-07-22 14:40:19 +02:00
Fabio Alessandrelli acba901087 [WebSocket] Allow reusing closing and closed peers 2024-07-10 12:56:40 +02:00
A Thousand Ships 955d5affa8 Reduce and prevent unnecessary random-access to List
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
Thaddeus Crews 9903e6779b Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
A Thousand Ships 684752e75b Replace error checks against size with is_empty 2024-02-09 12:50:15 +01:00