From fe6f646c9da52cb25538f93fa95dd86622886130 Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 24 Nov 2022 17:40:36 +0100 Subject: [PATCH] [WebSocket] Fix peer disconnection not closing the network layer. We were removing it from the MultiplayerAPI but not immediately destroying it (to avoid tricky in-signal de-referencing). We still need to properly close the connection in this case if we want the remote peer to be notified immediately. --- networking/websocket_multiplayer/script/main.gd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/networking/websocket_multiplayer/script/main.gd b/networking/websocket_multiplayer/script/main.gd index fadbca3a..a7c5934b 100644 --- a/networking/websocket_multiplayer/script/main.gd +++ b/networking/websocket_multiplayer/script/main.gd @@ -79,6 +79,10 @@ func _on_Host_pressed(): func _on_Disconnect_pressed(): + if peer is WebSocketServer: + peer.stop() + elif peer is WebSocketClient: + peer.disconnect_from_host() _close_network()