summaryrefslogtreecommitdiff
path: root/modules/enet/networked_multiplayer_enet.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-29 18:06:19 +0200
committerGitHub <noreply@github.com>2020-07-29 18:06:19 +0200
commitfa6cd2cd77c6521cbb8d89532c0fda20892a8a2c (patch)
treee7c9281d586f7206dd788ba7c5db8d004fbebe42 /modules/enet/networked_multiplayer_enet.cpp
parent7b17cd2a73d841ac8a3398fbeb8805a3bd707470 (diff)
parente5f3159a2323d1b5da19ee77936c40e04ef776df (diff)
Merge pull request #40838 from Faless/dtls/enet_refuse_fix
Fix crash in ENet changing refuse_new_connections
Diffstat (limited to 'modules/enet/networked_multiplayer_enet.cpp')
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index ed3924f2d2..64977ad237 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -104,6 +104,7 @@ Error NetworkedMultiplayerENet::create_server(int p_port, int p_max_clients, int
if (dtls_enabled) {
enet_host_dtls_server_setup(host, dtls_key.ptr(), dtls_cert.ptr());
}
+ enet_host_refuse_new_connections(host, refuse_connections);
#endif
_setup_compressor();
@@ -160,6 +161,7 @@ Error NetworkedMultiplayerENet::create_client(const String &p_address, int p_por
if (dtls_enabled) {
enet_host_dtls_client_setup(host, dtls_cert.ptr(), dtls_verify, p_address.utf8().get_data());
}
+ enet_host_refuse_new_connections(host, refuse_connections);
#endif
_setup_compressor();
@@ -641,7 +643,9 @@ int NetworkedMultiplayerENet::get_unique_id() const {
void NetworkedMultiplayerENet::set_refuse_new_connections(bool p_enable) {
refuse_connections = p_enable;
#ifdef GODOT_ENET
- enet_host_refuse_new_connections(host, p_enable);
+ if (active) {
+ enet_host_refuse_new_connections(host, p_enable);
+ }
#endif
}