summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-04-30 16:01:18 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-04-30 16:29:56 +0200
commitfc255bde298575ba368ded56f6ff5b4799a787c5 (patch)
tree4ff9bcfa758d694e66598073c4b86f8457c513d8 /modules
parent66f696c2c16af1d88a016cc725fd10cac79bb838 (diff)
[Net] ENet non-relaying server now process broadcasts.
Setting `server_relay = false` prevents the server from letting clients communicate with each other, but without this fix, the server would also ignore broadcast packets. With this change, the server still does not relay messages to other clients, but will correctly process broadcast messages (and "exclusive" messages) as if they were directed to just the server.
Diffstat (limited to 'modules')
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index 1cf77b307d..0d29e638ae 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -362,7 +362,10 @@ void NetworkedMultiplayerENet::poll() {
// To myself and only myself
incoming_packets.push_back(packet);
} else if (!server_relay) {
- // No other destination is allowed when server is not relaying
+ // When relaying is disabled, other destinations will only be processed by the server.
+ if (target == 0 || target < -1) {
+ incoming_packets.push_back(packet);
+ }
continue;
} else if (target == 0) {
// Re-send to everyone but sender :|