summaryrefslogtreecommitdiffstats
path: root/thirdparty/enet
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-05-12 19:55:58 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2023-05-12 20:08:10 +0200
commiteeac6f8c7f070a9f4674bfa51ec35c57516311c0 (patch)
treeb060293d6c34c9b72dccbb1b76ec5a02a5cf452b /thirdparty/enet
parent20ed51a9129f97bb8d001262155fb3ccfc1e3c89 (diff)
downloadredot-engine-eeac6f8c7f070a9f4674bfa51ec35c57516311c0.tar.gz
[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.
Diffstat (limited to 'thirdparty/enet')
-rw-r--r--thirdparty/enet/godot.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/thirdparty/enet/godot.cpp b/thirdparty/enet/godot.cpp
index ea7f4957a2..2cbfe59fc6 100644
--- a/thirdparty/enet/godot.cpp
+++ b/thirdparty/enet/godot.cpp
@@ -436,6 +436,7 @@ ENetSocket enet_socket_create(ENetSocketType type) {
}
int enet_host_dtls_server_setup(ENetHost *host, void *p_options) {
+ ERR_FAIL_COND_V_MSG(!DTLSServer::is_available(), -1, "DTLS server is not available in this build.");
ENetGodotSocket *sock = (ENetGodotSocket *)host->socket;
if (!sock->can_upgrade()) {
return -1;
@@ -446,6 +447,7 @@ int enet_host_dtls_server_setup(ENetHost *host, void *p_options) {
}
int enet_host_dtls_client_setup(ENetHost *host, const char *p_for_hostname, void *p_options) {
+ ERR_FAIL_COND_V_MSG(!PacketPeerDTLS::is_available(), -1, "DTLS is not available in this build.");
ENetGodotSocket *sock = (ENetGodotSocket *)host->socket;
if (!sock->can_upgrade()) {
return -1;