summaryrefslogtreecommitdiff
path: root/modules/enet
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-07-30 03:32:24 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-07-30 15:25:37 +0200
commitb4fc69e0e276b2b8cb224aa857e4fc838ff9237b (patch)
treec3964e7b08b635400f4a1e3aefe0340c0fba1ee6 /modules/enet
parente95e33f25137486d2df0a1c13e17394454c7fdf1 (diff)
[Net] Fix ENet 'connect_to_host' creating only one channel.
Passing `0` to `enet_host_create` will allow the maximum amount of channel supported by ENet. For some reasons, `connect_to_host` will instead only create 1 channel when passed `0`. This commit normalize the behaviour to always allocate the maximum allowed channels when passing `0`.
Diffstat (limited to 'modules/enet')
-rw-r--r--modules/enet/enet_connection.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/enet/enet_connection.cpp b/modules/enet/enet_connection.cpp
index 0bda9402f8..e833264d6a 100644
--- a/modules/enet/enet_connection.cpp
+++ b/modules/enet/enet_connection.cpp
@@ -107,7 +107,7 @@ Ref<ENetPacketPeer> ENetConnection::connect_to_host(const String &p_address, int
address.port = p_port;
// Initiate connection, allocating enough channels
- ENetPeer *peer = enet_host_connect(host, &address, p_channels, p_data);
+ ENetPeer *peer = enet_host_connect(host, &address, p_channels > 0 ? p_channels : ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT, p_data);
if (peer == nullptr) {
return nullptr;