summaryrefslogtreecommitdiffstats
path: root/modules/multiplayer
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-04-22 14:16:00 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-04-22 14:58:45 +0200
commitc6be5f130c7e7a8de12a719a33253ee4674ba8a6 (patch)
tree48a84d2c9b96351d036816a1375f60b08c3ebf6d /modules/multiplayer
parent7529c0bec597d70bc61975a82063bb5112ac8879 (diff)
downloadredot-engine-c6be5f130c7e7a8de12a719a33253ee4674ba8a6.tar.gz
[MP] Fix disconnect_peer not doing the proper cleanup
Lower layers (cache, replication) were not being notified about the peer being disconnected.
Diffstat (limited to 'modules/multiplayer')
-rw-r--r--modules/multiplayer/scene_multiplayer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/multiplayer/scene_multiplayer.cpp b/modules/multiplayer/scene_multiplayer.cpp
index 99aba680cc..e2ebca0c88 100644
--- a/modules/multiplayer/scene_multiplayer.cpp
+++ b/modules/multiplayer/scene_multiplayer.cpp
@@ -425,11 +425,11 @@ void SceneMultiplayer::_del_peer(int p_id) {
void SceneMultiplayer::disconnect_peer(int p_id) {
ERR_FAIL_COND(multiplayer_peer.is_null() || multiplayer_peer->get_connection_status() != MultiplayerPeer::CONNECTION_CONNECTED);
- if (pending_peers.has(p_id)) {
- pending_peers.erase(p_id);
- } else if (connected_peers.has(p_id)) {
- connected_peers.erase(p_id);
- }
+ // Block signals to avoid emitting peer_disconnected.
+ bool blocking = is_blocking_signals();
+ set_block_signals(true);
+ _del_peer(p_id);
+ set_block_signals(blocking);
multiplayer_peer->disconnect_peer(p_id);
}