Commit Graph

293 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Thaddeus Crews b17aa3343a
Revert "SCons: Add `CPPEXTPATH` for external includes" 2025-10-06 13:09:22 +07: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 +07: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 +07:00
kobewi 13f642d959
Replace XML codeblock spaces with tabs 2025-06-06 14:35:38 +07:00
Haoyu Qiu 1e82bafa3a Remove redundant info on the enum types used 2025-06-04 08:21:47 +07: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 +07: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 +07: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 +07:00
Thaddeus Crews f25fc34439
SCons: Add `CPPEXTPATH` for external includes 2025-04-02 07:29:08 +07:00
Yufeng Ying 4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +07:00
Lukas Tenbrink ffa6ef220b Use `append_` instead of `parse_` for `String` methods. 2025-03-27 17:51:02 +07:00
Thaddeus Crews f09ee0171a
Style: Begin integrating simple `.clangd` fixes 2025-03-22 13:24:35 +07:00
Rémi Verschelde 2fa721b1bc
Merge pull request #104127 from Ivorforce/360-noclip
Remove `String` clipping constructors.
2025-03-19 12:27:10 +07: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 +07:00
kobewi 7cb2fb189a Remove TOOLS_ENABLED checks from editor/ 2025-03-14 18:13:16 +07:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 +07: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 +07: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 +07:00
Adam Scott 33e16435f5
Replace some problematic uses of `String::num` to `String::num_int64` 2025-01-15 12:51:51 +07: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 +07: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 +07: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 +07:00
Fabio Alessandrelli 95401f0753 [WebSocket] Clarify that connect_to_url is non-blocking 2024-11-27 13:31:28 +07: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 +07: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 +07: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 +07: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 +07: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 +07:00
Haoyu Qiu 6516ca6b11 Parse fragment from URL 2024-09-27 19:42:30 +07:00
Thaddeus Crews 9f9ee0c813
SCons: Add unobtrusive type hints in SCons files 2024-09-25 09:34:35 +07:00
Daylily-Zeleen 3d575801ce Allow ClassDB to create a Object without postinitialization for GDExtension. 2024-08-20 20:19:02 +07: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 +07: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 +07: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 +07:00
Fabio Alessandrelli acba901087 [WebSocket] Allow reusing closing and closed peers 2024-07-10 12:56:40 +07: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 +07:00
Thaddeus Crews 9903e6779b
Enforce template syntax `typename` over `class` 2024-03-07 22:39:09 +07:00
A Thousand Ships 684752e75b
Replace error checks against `size` with `is_empty` 2024-02-09 12:50:15 +07:00
Rémi Verschelde 5e9d096f06
Merge pull request #79407 from zaevi/fix_web_websocket-close-reason
[Web] Fix WebSocket returning empty close-reason.
2023-10-13 11:42:41 +07:00
Adam Scott 78c2a08fae
Add `proxy_to_pthread` option to `platform=web`
Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
2023-10-09 11:50:01 +07:00
A Thousand Ships 517e9f8aef [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicable 2023-09-26 16:44:52 +07:00
Rémi Verschelde 8de6405288
UWP: Remove platform port, needs to be redone from scratch for 4.x
The UWP platform port was never ported to the Godot 4.0+ API,
and it's now accumulating bitrot as it doesn't compile, and thus
we no longer propagate platform changes in it.

So we finally remove to acknowledge this state. There's still some
interest in reviving the UWP port eventually, especially as support
for Direct3D 12 will soon be merged, but when that happens it will
be easiest to redo it from scratch.
2023-09-07 15:01:59 +07:00
Zae 7689f48a75 [Web]Fix WebSocket returning empty close-reason. 2023-07-13 13:04:32 +07:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +07:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +07:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +07:00
Fabio Alessandrelli eeac6f8c7f [TLS] Fix crashes trying to use TLS when not available.
If no StreamPeerTLS implementation is available, HTTPClient and
WebSocketPeer will now correctly refuse to connect using TLS returning
ERR_UNAVAILABLE.

Similarly, ENetConnection will refuse to setup DTLS when PacketPeerDTLS
is not available.
2023-05-12 20:08:10 +07:00
Yuri Sizov 391eccca76 Validate code tags in documentation for potential params
Adds a check to make_rst to look for matches
between the text inside of the [code][/code] tag
and known param identifiers.
Fixes most of what was revealed.
2023-04-26 21:36:04 +07:00