Godot Engine – Multi-platform 2D and 3D game engine
Fix `maxPacketLifeTime` typo in WebRTCMultiplayerPeer channel config
Shane Gadsbycaa386e89570
diff --git a/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml b/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xmlindex da4bc174716..8eb12316cdd 100644--- a/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml+++ b/modules/webrtc/doc_classes/WebRTCMultiplayerPeer.xml@@ -19,7 +19,7 @@<param index="2" name="unreliable_lifetime" type="int" default="1" /><description>Add a new peer to the mesh with the given [param peer_id]. The [WebRTCPeerConnection] must be in state [constant WebRTCPeerConnection.STATE_NEW].- Three channels will be created for reliable, unreliable, and ordered transport. The value of [param unreliable_lifetime] will be passed to the [code]"maxPacketLifetime"[/code] option when creating unreliable and ordered channels (see [method WebRTCPeerConnection.create_data_channel]).+ Three channels will be created for reliable, unreliable, and ordered transport. The value of [param unreliable_lifetime] will be passed to the [code]"maxPacketLifeTime"[/code] option when creating unreliable and ordered channels (see [method WebRTCPeerConnection.create_data_channel]).</description></method><method name="create_client">diff --git a/modules/webrtc/doc_classes/WebRTCPeerConnection.xml b/modules/webrtc/doc_classes/WebRTCPeerConnection.xmlindex 8046ac343f2..dc3377ff804 100644--- a/modules/webrtc/doc_classes/WebRTCPeerConnection.xml+++ b/modules/webrtc/doc_classes/WebRTCPeerConnection.xml@@ -48,7 +48,7 @@# Only one of maxRetransmits and maxPacketLifeTime can be specified, not both. They make the channel unreliable (but also better at real time)."maxRetransmits": 1, # Specify the maximum number of attempt the peer will make to retransmits packets if they are not acknowledged."maxPacketLifeTime": 100, # Specify the maximum amount of time before giving up retransmitions of unacknowledged packets (in milliseconds).- "ordered": true, # When in unreliable mode (i.e. either "maxRetransmits" or "maxPacketLifetime" is set), "ordered" (true by default) specify if packet ordering is to be enforced.+ "ordered": true, # When in unreliable mode (i.e. either "maxRetransmits" or "maxPacketLifeTime" is set), "ordered" (true by default) specify if packet ordering is to be enforced."protocol": "my-custom-protocol", # A custom sub-protocol string for this channel.}diff --git a/modules/webrtc/webrtc_multiplayer_peer.cpp b/modules/webrtc/webrtc_multiplayer_peer.cppindex f6e890d7618..79c7b8d7dbf 100644--- a/modules/webrtc/webrtc_multiplayer_peer.cpp+++ b/modules/webrtc/webrtc_multiplayer_peer.cpp@@ -220,10 +220,10 @@ Error WebRTCMultiplayerPeer::_initialize(int p_self_id, NetworkMode p_mode, consswitch (mode) {case TRANSFER_MODE_UNRELIABLE_ORDERED:- cfg["maxPacketLifetime"] = 1;+ cfg["maxPacketLifeTime"] = 1;break;case TRANSFER_MODE_UNRELIABLE:- cfg["maxPacketLifetime"] = 1;+ cfg["maxPacketLifeTime"] = 1;cfg["ordered"] = false;break;case TRANSFER_MODE_RELIABLE:@@ -311,7 +311,7 @@ Error WebRTCMultiplayerPeer::add_peer(const Ref<WebRTCPeerConnection> &p_peer, iERR_FAIL_COND_V(peer->channels.get(CH_RELIABLE).is_null(), FAILED);cfg["id"] = 2;- cfg["maxPacketLifetime"] = p_unreliable_lifetime;+ cfg["maxPacketLifeTime"] = p_unreliable_lifetime;peer->channels.get(CH_ORDERED) = p_peer->create_data_channel("ordered", cfg);ERR_FAIL_COND_V(peer->channels.get(CH_ORDERED).is_null(), FAILED);