Merge pull request #91011 from Faless/mp/fix_disconnect_on_change
[MP] Fix `disconnect_peer` not doing the proper cleanup
This commit is contained in:
commit
9559330187
1 changed files with 5 additions and 5 deletions
|
@ -425,11 +425,11 @@ void SceneMultiplayer::_del_peer(int p_id) {
|
||||||
|
|
||||||
void SceneMultiplayer::disconnect_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);
|
ERR_FAIL_COND(multiplayer_peer.is_null() || multiplayer_peer->get_connection_status() != MultiplayerPeer::CONNECTION_CONNECTED);
|
||||||
if (pending_peers.has(p_id)) {
|
// Block signals to avoid emitting peer_disconnected.
|
||||||
pending_peers.erase(p_id);
|
bool blocking = is_blocking_signals();
|
||||||
} else if (connected_peers.has(p_id)) {
|
set_block_signals(true);
|
||||||
connected_peers.erase(p_id);
|
_del_peer(p_id);
|
||||||
}
|
set_block_signals(blocking);
|
||||||
multiplayer_peer->disconnect_peer(p_id);
|
multiplayer_peer->disconnect_peer(p_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue