summaryrefslogtreecommitdiff
path: root/drivers/unix/net_socket_posix.cpp
AgeCommit message (Collapse)Author
2021-04-27Core: Drop custom `copymem`/`zeromem` definesRémi Verschelde
We've been using standard C library functions `memcpy`/`memset` for these since 2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb. There was still the possibility for third-party platform ports to override the definitions with a custom header, but this doesn't seem useful anymore.
2021-04-27Merge pull request #47398 from Faless/feature/network-local-port-salvagedRémi Verschelde
2021-04-26[Net] Fix socket poll timeout on Windows.Fabio Alessandrelli
Now correctly computes the timeout value in milliseconds.
2021-04-12Allow local port control on net_socket connectionsdam
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-11-20doc: Warn about using Node internal processingRémi Verschelde
See #43689. Also 'fixed' some spelling for behavior in publicly visible strings. (Sorry en_GB, en_CA, en_AU, and more... Silicon Valley won the tech spelling war.)
2020-06-03Remove 32-bit String to_int methodAaron Franke
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-02-19Fix set_reuse_address on non-Windows platforms.Fabio Alessandrelli
Broken after cae0d8853d7a373ad8720289c12c7c2e7b5ef240 .
2020-02-18Merge pull request #36321 from Faless/net/win_tcp_noreuseRémi Verschelde
Disable NetSocket reuse address on Windows.
2020-02-18Disable NetSocket reuse address on Windows.Fabio Alessandrelli
It actually means reuse port -.- ...
2020-02-16Add peek option to NetSocket recv_from.Fabio Alessandrelli
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-17Make NetSockets quiter.Fabio Alessandrelli
Use print_verbose instead of ERR_* for network errors.
2019-12-14UDP sockets broadcast is now disabled by default.Fabio Alessandrelli
Add method `set_broadcast_enabled` to allow enabling broadcast via GDScript.
2019-12-10NetSocket set_broadcast_enabled returns Error enumFabio Alessandrelli
2019-10-25Use WSAConnect instead of connect on Windows.Fabio Alessandrelli
The misterious windows networking stack... Using connect instead of WSAConnect causes socket error 10022 under certain conditions. See: https://github.com/godotengine/webrtc-native/ (issue 6) Having to guess, code path for connect is different then WSAConnect with NULL extra parameters. The only reference about weird error with this code mentions something called "Windows Filtering Platform" but windows internals are, as always, obscure. This might be something to try and report to Microsoft if anyone has the time to spare with the likely outcome of being ignored.
2019-10-08Merge pull request #32616 from Faless/net/fix_close_execRémi Verschelde
Disable socket descriptor sharing with subprocs.
2019-10-07Disable socket descriptor sharing with subprocs.Fabio Alessandrelli
On Unix systems, sockets are like file descriptors, and file descriptors are usually shared among child processes. This means, that if we spawn a subprocess (or we fork) like we do in the editor, open file descriptors will leak to the new process. This causes issue with sockets as they might remain open and bound (listening) when the original process closes.
2019-09-30Optional Unix Socket disable for devices that do not support itJairo
2019-07-10Use reference to constant in functionsqarmin
2019-07-01Merge pull request #30126 from qarmin/remove_unnecessary_codeRémi Verschelde
Remove unnecessary code and add some error explanations
2019-07-01Remove unnecessary code and add some error explanationsqarmin
2019-06-28Properly disable SIGPIPE on OSX network sockets.Fabio Alessandrelli
Disable SO_NOSIGPIPE socket option when avaiable. Use MSG_NOSIGNAL send flag on systems that support it.
2019-06-27Merge pull request #29941 from qarmin/redundant_code_and_othersRémi Verschelde
Remove redundant code, possible NULL pointers and others
2019-06-26Some code changed with Clang-Tidyqarmin
2019-06-21Merge pull request #29935 from Faless/net/get_if_multicast_prRémi Verschelde
Multicast, more network interfaces info
2019-06-21Multicast support in NetSocket/PacketPeerUDPFabio Alessandrelli
2019-06-20Merge pull request #29283 from qarmin/fix_some_always_same_valuesRémi Verschelde
Remove always true/false values
2019-06-20Fix always true/false valuesqarmin
2019-06-15Fix compilation warnings in JS and Windows buildsRémi Verschelde
Warnings raised by Emscripten 1.38.0 and MinGW64 5.0.4 / GCC 8.3.0. JS can now build with `werror=yes warnings=extra`. MinGW64 still has a few warnings to resolve with `warnings=extra`, and only one with `warnings=all`. Part of #29033 and #29801.
2019-05-02Ignore a warning in _get_socket_error (-Wlogical-op).marxin
drivers/unix/net_socket_posix.cpp: In member function 'NetSocketPosix::NetError NetSocketPosix::_get_socket_error()': drivers/unix/net_socket_posix.cpp:197:22: warning: logical 'or' of equal expressions [-Wlogical-op] 197 | if (errno == EAGAIN || errno == EWOULDBLOCK) | ^ and: modules/mono/utils/string_utils.cpp: In function 'int {anonymous}::sfind(const String&, int)': modules/mono/utils/string_utils.cpp:68:48: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op] found = src[read_pos] == 's' || (c >= '0' || c <= '4'); ~~~~~~~~~^~~~~~~~~~~
2019-02-13Fix typos with codespellRémi Verschelde
Using codespell 1.14.0. Method: ``` $ cat > ../godot-word-whitelist.txt << EOF ang doubleclick lod nd numer que te unselect EOF $ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po" $ git diff // undo unwanted changes ```
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-11Moved member variables to initializer listWilson E. Alvarez
2018-11-18Properly accept wildcard when binding IPv4 socket.Fabio Alessandrelli
Also never return null for is_ipv4 to avoid crashes due to engine bug. (better to get an error and a broken socket then seeing your game crash)
2018-10-29Server platform works on OS X tooMarcelo Fernandez
2018-10-06Fix warnings in HTML5 build outside platform filesLeon Krause
2018-09-28Remove socket_helper.h after NetSocket refactorFabio Alessandrelli
2018-09-27Fix invalid comparison warnings: [-Wbool-compare] and [-Wenum-compare]Rémi Verschelde
Fixes the following GCC 5 warnings and actual bugs: ``` drivers/unix/net_socket_posix.cpp:562:28: warning: comparison between 'enum IP::Type' and 'enum NetSocket::Type' [-Wenum-compare] modules/gdscript/gdscript_function.cpp:792:26: warning: comparison of constant '17' with boolean expression is always true [-Wbool-compare] modules/gdscript/gdscript_function.cpp:792:26: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] modules/gdscript/gdscript_parser.cpp:5082:58: warning: comparison of constant '6' with boolean expression is always false [-Wbool-compare] modules/gdscript/gdscript_parser.cpp:5082:58: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] modules/mbedtls/stream_peer_mbed_tls.cpp:286:45: warning: comparison between 'enum StreamPeerTCP::Status' and 'enum StreamPeerSSL::Status' [-Wenum-compare] modules/mbedtls/stream_peer_mbed_tls.cpp:313:45: warning: comparison between 'enum StreamPeerTCP::Status' and 'enum StreamPeerSSL::Status' [-Wenum-compare] ```
2018-09-22Fix Winsock UDP ECONNRESET/ENETRESET bugFabio Alessandrelli
Since Windows 2000: Calling recv/recvfrom when an ICMP reply was received from a previous send/sendto, may result in a WSAECONNRESET error. Since Windows Vista(?)/Windows Server 2008: Calling recv/recvfrom when an ICMP reply was received from a previous send/sendto, may also result in a WSAENETRESET error. Both those features are disabled by this commit using disabling SIO_UDP_CONNRESET and SIO_UDP_NETRESET on newly created UDP sockets.
2018-09-22Detect POLLERR revents too in NetSocketPosix.Fabio Alessandrelli
Usually indicate an RST was received by a TCP socket.
2018-09-22Use select instead of WSAPoll on Windows.Fabio Alessandrelli
WSAPoll is broken by design. It was announced as the new way to introduce compatibility to posix sockets, their implementation was broken, and they decided not to fix it. You can read the full story here: https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
2018-09-13Properly initialize Winsock on startupFabio Alessandrelli
Also fix typo in _get_last_error which caused Winsock connect to fail.
2018-09-12New NetSocket interface, BSD/Win implementationFabio Alessandrelli
Unified BSD and Winsock sockets into a single implementation of a generic NetSocket interface. This is some ground work for few network improvements: - Reuse as much code as possible between Posix and Windows. - Provide a single point of implementation for exotic sdks (consoles). - Provide platform agnostic StreamPeerTCP and PacketPeerUDP in core. - Implement connect for UDP allowing for DTLS implementation.