diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-12-15 12:38:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 12:38:10 +0100 |
commit | 703a1be507539d7ebf1b4e2b3dadbe4dde36fc5e (patch) | |
tree | 6608fbf8bafca23aa48148fa2d2b0285409fe160 | |
parent | 859549e1365978ecbddb10a9758906b08864ba23 (diff) | |
parent | 84112d96103073578820e045bb0017a25488ab93 (diff) |
Merge pull request #55952 from Faless/net/4.x_webrtc_mp_connect_fix
-rw-r--r-- | modules/webrtc/webrtc_multiplayer_peer.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/modules/webrtc/webrtc_multiplayer_peer.cpp b/modules/webrtc/webrtc_multiplayer_peer.cpp index 133bd71ddb..20fe63bf7d 100644 --- a/modules/webrtc/webrtc_multiplayer_peer.cpp +++ b/modules/webrtc/webrtc_multiplayer_peer.cpp @@ -146,6 +146,10 @@ void WebRTCMultiplayerPeer::_find_next_peer() { } // After last. while (E) { + if (!E->get()->connected) { + E = E->next(); + continue; + } for (const Ref<WebRTCDataChannel> &F : E->get()->channels) { if (F->get_available_packet_count()) { next_packet_peer = E->key(); @@ -157,6 +161,10 @@ void WebRTCMultiplayerPeer::_find_next_peer() { E = peer_map.front(); // Before last while (E) { + if (!E->get()->connected) { + E = E->next(); + continue; + } for (const Ref<WebRTCDataChannel> &F : E->get()->channels) { if (F->get_available_packet_count()) { next_packet_peer = E->key(); @@ -378,6 +386,9 @@ int WebRTCMultiplayerPeer::get_available_packet_count() const { } int size = 0; for (const KeyValue<int, Ref<ConnectedPeer>> &E : peer_map) { + if (!E.value->connected) { + continue; + } for (const Ref<WebRTCDataChannel> &F : E.value->channels) { size += F->get_available_packet_count(); } |