Limit number of TURN servers to 32
Limit the number of TURN servers to 32 in order to allow the prioritization to assume a fixed offset for (de)prioritizing candidates. See https://github.com/w3c/webrtc-pc/pull/2679 for discussion including some data on current usage. Guarded by WebRTC-LimitTurnServers which is used as a killswitch. BUG=webrtc:13195 Change-Id: Ib12726af426ae4238aa7eb6aa062c71af52d495f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/285340 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Philipp Hancke <phancke@microsoft.com> Reviewed-by: Florent Castelli <orphis@webrtc.org> Cr-Commit-Position: refs/heads/main@{#38767}
This commit is contained in:

committed by
WebRTC LUCI CQ

parent
b889a7aee4
commit
41a8357170
@ -25,6 +25,10 @@
|
|||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
|
|
||||||
|
// TURN servers are limited to 32 in accordance with
|
||||||
|
// https://w3c.github.io/webrtc-pc/#dom-rtcconfiguration-iceservers
|
||||||
|
static constexpr size_t kMaxTurnServers = 32;
|
||||||
|
|
||||||
// Candidate for ICE based connection discovery.
|
// Candidate for ICE based connection discovery.
|
||||||
// TODO(phoglund): remove things in here that are not needed in the public API.
|
// TODO(phoglund): remove things in here that are not needed in the public API.
|
||||||
|
|
||||||
|
@ -605,6 +605,16 @@ RTCError PeerConnection::Initialize(
|
|||||||
return parse_error;
|
return parse_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restrict number of TURN servers.
|
||||||
|
if (!trials().IsDisabled("WebRTC-LimitTurnServers") &&
|
||||||
|
turn_servers.size() > cricket::kMaxTurnServers) {
|
||||||
|
RTC_LOG(LS_WARNING) << "Number of configured TURN servers is "
|
||||||
|
<< turn_servers.size()
|
||||||
|
<< " which exceeds the maximum allowed number of "
|
||||||
|
<< cricket::kMaxTurnServers;
|
||||||
|
turn_servers.resize(cricket::kMaxTurnServers);
|
||||||
|
}
|
||||||
|
|
||||||
// Add the turn logging id to all turn servers
|
// Add the turn logging id to all turn servers
|
||||||
for (cricket::RelayServerConfig& turn_server : turn_servers) {
|
for (cricket::RelayServerConfig& turn_server : turn_servers) {
|
||||||
turn_server.turn_logging_id = configuration.turn_logging_id;
|
turn_server.turn_logging_id = configuration.turn_logging_id;
|
||||||
@ -1549,6 +1559,17 @@ RTCError PeerConnection::SetConfiguration(
|
|||||||
if (!parse_error.ok()) {
|
if (!parse_error.ok()) {
|
||||||
return parse_error;
|
return parse_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restrict number of TURN servers.
|
||||||
|
if (!trials().IsDisabled("WebRTC-LimitTurnServers") &&
|
||||||
|
turn_servers.size() > cricket::kMaxTurnServers) {
|
||||||
|
RTC_LOG(LS_WARNING) << "Number of configured TURN servers is "
|
||||||
|
<< turn_servers.size()
|
||||||
|
<< " which exceeds the maximum allowed number of "
|
||||||
|
<< cricket::kMaxTurnServers;
|
||||||
|
turn_servers.resize(cricket::kMaxTurnServers);
|
||||||
|
}
|
||||||
|
|
||||||
// Add the turn logging id to all turn servers
|
// Add the turn logging id to all turn servers
|
||||||
for (cricket::RelayServerConfig& turn_server : turn_servers) {
|
for (cricket::RelayServerConfig& turn_server : turn_servers) {
|
||||||
turn_server.turn_logging_id = configuration.turn_logging_id;
|
turn_server.turn_logging_id = configuration.turn_logging_id;
|
||||||
|
Reference in New Issue
Block a user