Commit graph

63 commits

Author SHA1 Message Date
Fabio Alessandrelli 53c2e2da50 WebSocketServer now sanitize destination peers.
When relaying messages in multiplayer mode.
Could cause a crash in case a malicious client sends a bogus packet and
for those cases where a peer has just disconnected and a message arrive
from another peer with the disconnected one as destination.

(cherry picked from commit 17be67b8c7)
2019-11-08 15:48:18 +01:00
Fabio Alessandrelli cd0ba31533 Fix WebSocketServer relaying message 2 times.
The WebSocketMultiplayerPeer was relaying the same message two times,
both in _server_relay and _process_multiplayer (which was only supposed
to store the packet, given the server was one of the destination).

_process_multiplayer now only store the packet, and calls _server_relay
which will relay the message to other clients if needed.

(cherry picked from commit d1539db2c6)
2019-11-08 15:48:18 +01:00
Rémi Verschelde 383c678a1e doc: Replace all [code]CONSTANT[/code] by new [constant CONSTANT] hyperlinks
(cherry picked from commit bc82781f7d)
2019-07-29 17:32:54 +02:00
Rémi Verschelde df6a6a2004 doc: Sync classref with current source 2019-07-05 11:34:47 +02:00
Fabio Alessandrelli 20a37529f5 Revert "Update libwebsockets to 3.1 (plus UWP patch)"
This reverts commit 90210c4862.

(cherry picked from commit be414e4476)
2019-06-04 11:05:33 +02:00
Rémi Verschelde a485d862f1 doc: Sync classref with current source 2019-04-25 14:00:31 +02:00
Rémi Verschelde 53d73f59eb doc: Drop unused <demos> tag
(cherry picked from commit 6af69f851a)
2019-04-19 13:10:25 +02:00
marxin e3ae29e666 Enable warnings=extra on clang and GCC testers.
And remove 2 warnings from warnings=extra.

(cherry picked from commit e7f22ebdcd)
2019-04-03 16:52:01 +02:00
Fabio Alessandrelli 90210c4862 Update libwebsockets to 3.1 (plus UWP patch) 2019-03-06 02:02:52 +01:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
marxin 155cbe0b37 Fix warnings seen with warnings=all and recent GCC 8.2. 2019-02-18 21:54:31 +01:00
Rémi Verschelde fe7e11e008 Modules: Ensure classes match their header filename
Renamed:
- `modules/mono/mono_gd/gd_mono_class_member.h` -> `i_mono_class_member.h`
- `modules/upnp/upnpdevice.h` -> `upnp_device.h`
- `modules/websocket/websocket_multiplayer.h` -> `websocket_multiplayer_peer.h`
2019-02-12 22:59:56 +01:00
Fabio Alessandrelli 14e59ff112 Update docs and errors for WebSocket module 2019-01-28 02:12:50 +01:00
Rémi Verschelde 26fddb77be doc: Fix wrong references found by new makerst.py
Thanks @PJB3005
2019-01-07 10:06:12 +01:00
Rémi Verschelde b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde d1f3b622f0 Fix missing/malformed license headers 2019-01-01 12:46:36 +01:00
Fabio Alessandrelli 77466285f2 Fix HTML5 WebSocket client buffers size. 2018-12-26 17:51:12 +01:00
Rémi Verschelde 6cdcde7114 doc: Add missing commas after "If true/false" 2018-12-20 13:47:12 +01:00
Fabio Alessandrelli c3d3f1dedb Websocket LWS keep servicing till no CB are left
Apparently, only a single WRITABLE/READABLE callback is called at each
servicing. For this reason, we want to keep servicing until we end up
not receiving any callback.
When that happens, we can assume that we can't (or don't want to) write
more, and that there is nothing left to read in the socket buffer.
2018-11-25 17:25:03 +01:00
Fabio Alessandrelli c066db4d59 Convert WebSocket module to use PacketBuffer class 2018-11-12 22:55:17 +01:00
Fabio Alessandrelli 4847b5bff5 Add new PacketBuffer class for buffered peers 2018-11-12 21:49:50 +01:00
Rémi Verschelde c02cd5139f
Merge pull request #23490 from Faless/lws_client_memfix
Fix access to freed mem in WS client after #23241
2018-11-10 22:18:42 +01:00
Juan Linietsky f2e54057ae -Moved EditorDefaultValue to ClassDB, made it core
-Removed one and zero hints for properties, replaced by default value
2018-11-08 11:30:59 -03:00
Fabio Alessandrelli e3008b71c3 Fix access to freed mem in WS client after #23241
I was wrong in assuming that String had to survive long enough to avoid
it, what actually needed to survive was the CharString obtained from the
acsii() or utf8() function.
At least according to valgrind
2018-11-03 23:39:15 +01:00
Fabio Alessandrelli e6a069119b Add missing EMWSServer::poll function.
Empty of course as server is not supported in HTML5, but the symbol must
be defined.
2018-10-23 12:49:24 +02:00
Fabio Alessandrelli bafcde805c Remove unneeded strncpy in lws_client.
Pass the String buffer directly, lws_client_connect_via_info will copy
them for us.
2018-10-23 12:31:47 +02:00
Dualtagh Murray b902a2f2a7 Fixing warnings generated by MSVC
Fixes #22684.
2018-10-19 11:45:24 +02:00
Fabio Alessandrelli d65afb2c74 Fix LWSClient connect_to_host string termination.
Coming from strncpy might get you a non-NULL terminated buffer.
The solution, if you accept trunction, is to give one less byte to
strncpy and manually set the last char in the buffer to '\0'.
If the source string is shorter, than the buffer is padded with '\0'
automatically.
2018-10-07 14:50:14 +02:00
Fabio Alessandrelli 8b2688786f Fix -Wunused-function in websocket module 2018-09-29 22:26:32 +02:00
Rémi Verschelde 3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Fabio Alessandrelli 9d9a14e289 Remove socket_helper.h after NetSocket refactor 2018-09-28 02:03:23 +02:00
Rémi Verschelde cda5b0bfe1 Fix warnings about unused variables [-Wunused-variable]
Fixes the following GCC 5 warnings:
```
drivers/gles2/rasterizer_scene_gles2.cpp:1139:15: warning: unused variable 'offset' [-Wunused-variable]
drivers/gles2/rasterizer_scene_gles2.cpp:1205:39: warning: unused variable 'multi_mesh' [-Wunused-variable]
drivers/gles2/rasterizer_storage_gles2.cpp:359:7: warning: unused variable 'srgb' [-Wunused-variable]
drivers/gles2/shader_gles2.cpp:1016:45: warning: unused variable 'texture_hints' [-Wunused-variable]
editor/animation_track_editor.cpp:776:9: warning: unused variable 'keys_to' [-Wunused-variable]
editor/editor_inspector.cpp:273:7: warning: unused variable 'vs_height' [-Wunused-variable]
editor/editor_themes.cpp:202:10: warning: unused variable 'begin_time' [-Wunused-variable]
editor/editor_themes.cpp:239:10: warning: unused variable 'end_time' [-Wunused-variable]
editor/plugins/animation_blend_tree_editor_plugin.cpp:726:17: warning: unused variable 'an' [-Wunused-variable]
editor/plugins/script_text_editor.cpp:1278:8: warning: unused variable 'fold_state' [-Wunused-variable]
main/main.cpp:132:13: warning: 'use_vsync' defined but not used [-Wunused-variable]
modules/cvtt/image_compress_cvtt.cpp:231:8: warning: unused variable 'y_end' [-Wunused-variable]
modules/cvtt/image_compress_cvtt.cpp:311:6: warning: unused variable 'shift' [-Wunused-variable]
modules/gdscript/gdscript_editor.cpp:58:7: warning: unused variable 'th' [-Wunused-variable]
modules/gridmap/grid_map.cpp:1084:6: warning: unused variable 'ofs' [-Wunused-variable]
modules/theora/video_stream_theora.cpp:442:9: warning: unused variable 'tr' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2606:6: warning: unused variable 'count' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2829:6: warning: unused variable 'seq_count' [-Wunused-variable]
modules/visual_script/visual_script_editor.cpp:2844:24: warning: unused variable 'vnode_function' [-Wunused-variable]
modules/websocket/lws_peer.cpp:122:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:135:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:63:12: warning: unused variable 'peer_data' [-Wunused-variable]
modules/websocket/lws_peer.cpp:91:12: warning: unused variable 'peer_data' [-Wunused-variable]
platform/android/export/export.cpp:763:16: warning: unused variable 'node_size' [-Wunused-variable]
scene/gui/rich_text_label.cpp:850:10: warning: unused variable 'x_ofs' [-Wunused-variable]
scene/gui/text_edit.cpp:653:8: warning: unused variable 'tab_w' [-Wunused-variable]
scene/resources/bit_mask.cpp:186:6: warning: unused variable 'i' [-Wunused-variable]
scene/resources/mesh.cpp:549:20: warning: '_array_name' defined but not used [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:107:10: warning: unused variable 'v2' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:108:10: warning: unused variable 'v3' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:109:10: warning: unused variable 'v4' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:110:10: warning: unused variable 'v5' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:111:10: warning: unused variable 'v0n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:112:10: warning: unused variable 'v1n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:113:10: warning: unused variable 'v2n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:114:10: warning: unused variable 'v3n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:115:10: warning: unused variable 'v4n' [-Wunused-variable]
servers/audio/audio_rb_resampler.cpp:116:10: warning: unused variable 'v5n' [-Wunused-variable]
servers/visual/default_mouse_cursor.xpm:2:21: warning: 'default_mouse_cursor_xpm' defined but not used [-Wunused-variable]
```
2018-09-27 16:25:24 +02:00
Fabio Alessandrelli df43b94e6e Update WebSocket documentation 2018-09-24 01:50:37 +02:00
Fabio Alessandrelli 4b92956db7 Implement WebSocket clean close detection. 2018-09-24 01:50:37 +02:00
Fabio Alessandrelli 5d91e87c64 Implement WebSocket close notify. 2018-09-24 01:50:37 +02:00
Rémi Verschelde 1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz 08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Rémi Verschelde 277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Fabio Alessandrelli 6bc97cc7cc Allow WebSocket connect with no sub-protocols. 2018-08-30 20:23:16 +02:00
Rémi Verschelde 139e621338
Merge pull request #20913 from pulkomandy/master
Rebase patches for fixing haiku build.
2018-08-13 21:26:15 +02:00
Adrien Destugues a294a842cb Rebase patches for fixing haiku build. 2018-08-11 17:20:51 +02:00
Fabio Alessandrelli 6a57f29573 Fix WebSocket crash due to non PDO init.
Move RingBuffer (and few related vars) to LWSPeer.
2018-08-06 03:47:02 +02:00
Wilson E. Alvarez a22e746bc3 Removed unnecessary assignments 2018-07-24 09:51:03 +02:00
Rémi Verschelde 7c9f7452f4 Style: Format code with clang-format 6.0.1 2018-07-18 16:27:03 +02:00
Fabio Alessandrelli 267b3746c5 Sanitize protocol struct, def LWS T/RX buffer size 2018-06-23 20:17:15 +02:00
Fabio Alessandrelli e56a3c1dc4 Bump libwebsockets to version 3.0.0 2018-06-07 18:07:35 +02:00
Rémi Verschelde d0811ed3f9 Thirdparty: Fill copyright for lws, miniupnpc, clipper
Rename `lws` to `libwebsockets` which is its library name.

Add missing license file for mbedtls.
2018-06-07 10:46:05 +02:00
Fabio Alessandrelli 6cda58a12f Fix LWSPeer get_connected_[host/port] 2018-06-06 18:34:08 +02:00
Rémi Verschelde 3334209a73 SCons: Pass env to modules can_build method
This allows to disable modules based on the environment,
in particular `env[tools]` which tells us if we are
building the editor or not.
2018-05-30 19:11:36 +02:00