Commit graph

214 commits

Author SHA1 Message Date
Yuri Sizov
c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Fabio Alessandrelli
202320e1ed [Websocket] Remove dummy JS server implemenation.
It does nothing but printing errors (only websocket client is available
in browsers), so we might as well return null when you instantiate it.
2022-08-07 13:44:16 +02:00
Fabio Alessandrelli
ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
2022-07-26 09:31:12 +02:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Fabio Alessandrelli
09a48e1055 [WebSocket] Fix WSLClient connection status.
Note, this keeps the old behaviour of reporting CONNECTION_CONNECTED
while disconnecting.
We should change this before 4.0, but needs further refactoring of the
WebSocket classes.
2022-05-04 20:13:32 +02:00
reduz
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
Fabio Alessandrelli
0275d60c1b
Merge pull request #60444 from snailrhymer/expand-websocketclient-error-messages
Add detail to some error messages in wsl_client
2022-05-03 06:07:09 +02:00
Rémi Verschelde
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Rémi Verschelde
6e6fe2b025
Merge pull request #59582 from Faless/net/4.x_tcp_explicit_poll 2022-04-27 13:56:58 +02:00
SnailRhymer
da8bfbf278 Add detail to some error messages in wsl_client
Add messages, and add expected and actual values to other messages in _verify_headers for easier troubleshooting.
2022-04-22 22:00:06 +01:00
Oğuzhan Eroğlu
fd4341fba4 Added set_extra_headers() to WebSocketServer 2022-04-12 17:50:53 +03:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde
5fe6984639 Modules: Don't build editor-specific classes in templates
They're moved to an `editor` subfolder so that we can easily handle them
separately.
2022-03-28 16:48:15 +02:00
Fabio Alessandrelli
331f1662df [Net] Drop is_connected_to_host for TCP and UDP.
The UDP method is now called `is_socket_connected` to limit confusion
with the actual host connection status which doesn't make sense in UDP.

The TCP method is completly dropped, use get_status instead.

The only one left is the WebSocketPeer one, which should be fine as is
for now.
2022-03-27 16:36:44 +02:00
Fabio Alessandrelli
0e52867668 [Net] Make StreamPeerTCP::_poll_connection explicit.
No longer hacked into `get_status` and renamed to `poll`.

The old `poll` (for *nix `poll`, win `select`) is now called `wait`.
2022-03-27 16:36:44 +02:00
Jason Knight
b659cfbd53 Use 3001 instead of 1001 when destroying a websocket. 2022-03-18 10:09:50 -06:00
reduz
6f51eca1e3 Discern between virtual and abstract class bindings
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract".
* Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions.
* Converted a large amount of classes from "abstract" to "virtual" where it makes sense.

Most classes that make sense have been converted. Missing:

* Physics servers
* VideoStream
* Script* classes.

which will go in a separate PR due to the complexity involved.
2022-03-10 12:28:11 +01:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
Hugo Locurcio
b68dd2e189
Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
Rémi Verschelde
1bdb82c64e
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.
2022-02-10 12:30:19 +01:00
Jordan Schidlowsky
1ec96bc206 [Net] Non-blocking WebSocket hostname resolution.
Hostname is now resolved during poll in WebSocketClient (wslay) to avoid
blocking during connect.
An attempt is still made to find the hostname in the resolver cache.
2022-02-05 02:22:43 +01:00
Omar Polo
bd448e5535 Rename or refactor macros to avoid leading underscores
These are not used consistently and some can conflict with
system-specific defines.  While here, also delete some unused macros.
2022-01-20 20:29:15 +01:00
Arnav Vijaywargiya
0c46f73b5e Fixed incorrect property types 2022-01-11 17:17:11 +05:30
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
kobewi
2cad775461 Fix usage of "Return" in the docs 2022-01-02 21:09:18 +01:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Nathan Franke
de7873c2d8
Auto-Increment Debugger Port
Note: This PR also changes the port of the GDScript Language Server from 6008 to 6005. This opens enough ports above the debug port (6007) for this change to be useful.
2021-12-04 15:25:13 -06:00
Rémi Verschelde
a706ef3272
wslay: Sync with upstream 45d22583b
45d22583b4

Mostly style changes, a couple new methods and fixes.
Tweak file structure a bit.
2021-11-19 15:47:20 +01:00
Fabio Alessandrelli
dae626ad64
Merge pull request #54344 from mhilbrunner/rpc-error-msgs
Websockets: Fix buffer size checks in put_packet(), silent failures/connection hangs
2021-10-29 16:12:34 +02:00
Max Hilbrunner
38126690c7 Websockets: Fix buffer size checks in put_packet()
Also check the error return value of wslay_event_queue_msg()
2021-10-29 15:35:57 +02:00
Max Hilbrunner
7a55aac49c Fix Macros -> Mactos typo in WEBSOCKETMACTOS_H 2021-10-28 12:45:00 +02:00
Max Hilbrunner
5dc02eb8b0 Save all 64 bits of get_ticks_msec() in more cases 2021-10-26 13:58:58 +02:00
Rémi Verschelde
5ae569560d
Fix missing argument names in bindings
While at it, tweak some boolean setters to use `p_enabled` for the bool.

Also renames `draw_minimap()` to `set_draw_minimap()`.
2021-10-09 00:20:10 +02:00
Infinixius
547ed239c0
Fix small typos regarding WebSocketPeer 2021-10-06 09:12:05 -04:00
Lightning_A
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
Fabio Alessandrelli
d18cbdf5e4
Merge pull request #52481 from Faless/net/4.x_native_peers
[Net] Extension system for network peers, webrtc.
2021-09-28 12:57:45 +02:00
Hugo Locurcio
7a62bd1e44
Document Android permission requirements for network access where needed 2021-09-25 12:32:46 +02:00
Fabio Alessandrelli
2d810e8cd9 [Net/Docs] Update extensions documentation. 2021-09-24 21:23:43 +02:00
Fabio Alessandrelli
25226329be [Net] MultiplayerPeer cleanup, defaults. 2021-09-24 18:40:39 +02:00
Aaron Franke
d54f2ad7ca
Don't generate empty doc sections and reduce code duplication 2021-09-20 20:59:33 -05:00
Rémi Verschelde
3cc01b2824
Merge pull request #52226 from Faless/debugger/4.x_start_options 2021-09-14 16:20:02 +02:00
Max Hilbrunner
5b25457794 Multiplayer networking renames/simplification
Removes _networking_ prefix from some methods and members, now that multiplayer has been largely moved out of Node and SceneTree and is seperated into its own set of classes.
2021-09-08 12:05:54 +02:00
Fabio Alessandrelli
bf9aae09ba [Net] Move multiplayer to core subdir, split RPCManager.
Move multiplayer classes to "core/multiplayer" subdir.

Move the RPCConfig and enums (TransferMode, RPCMode) to a separate
file (multiplayer.h), and bind them to the global namespace.

Move the RPC handling code to its own class (RPCManager).

Renames "get_rpc_sender_id" to "get_remote_sender_id".
2021-09-07 11:14:30 +02:00
Haoyu Qiu
fd52e18d19 Try other resolved IPs if one fails to connect 2021-08-30 13:00:48 +08:00
Fabio Alessandrelli
ecb2e8297c [Editor] Editor debugger binds according to editor settings. 2021-08-29 18:03:12 +02:00
Rémi Verschelde
c44ebb020d
HTML5: Fix warnings and re-enable werror=yes on CI
Add a missing call to disable warnings on a forked env for freetype's
`sfnt.c`.
2021-08-06 12:12:37 +02:00
Rémi Verschelde
0cee8831b2
Merge pull request #51005 from Faless/mp/4.x_channels
[Net] Implement RPC channels in MultiplayerAPI.
2021-08-04 09:31:33 +02:00
Rémi Verschelde
8465ecc3ae
Merge pull request #51036 from winterpixelgames/master-ws-fix
WebsocketPeer outbound buffer fixes and buffer size query
2021-08-01 11:12:15 +02:00
Jordan Schidlowsky
de02cf44ae Websocket peer outbound buffer fixes. Expose outbound buffered amount. 2021-07-31 19:48:31 -06:00