make ice server parsing error and logging more consistent

BUG=None

Change-Id: I1b88d01f8e592b11df31030ee70e6a39a4155773
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237220
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#35307}
This commit is contained in:
Philipp Hancke 2021-11-04 09:13:17 +01:00 committed by WebRTC LUCI CQ
parent 01343031cd
commit 05fadaccee
2 changed files with 5 additions and 5 deletions

View File

@ -237,7 +237,7 @@ static RTCErrorType ParseIceServerUrl(
if (server.username.empty() || server.password.empty()) {
// The WebRTC spec requires throwing an InvalidAccessError when username
// or credential are ommitted; this is the native equivalent.
RTC_LOG(LS_ERROR) << "TURN server with empty username or password";
RTC_LOG(LS_WARNING) << "TURN server with empty username or password";
return RTCErrorType::INVALID_PARAMETER;
}
// If the hostname field is not empty, then the server address must be
@ -251,7 +251,7 @@ static RTCErrorType ParseIceServerUrl(
if (!IPFromString(address, &ip)) {
// When hostname is set, the server address must be a
// resolved ip address.
RTC_LOG(LS_ERROR)
RTC_LOG(LS_WARNING)
<< "IceServer has hostname field set, but URI does not "
"contain an IP address.";
return RTCErrorType::INVALID_PARAMETER;
@ -289,7 +289,7 @@ RTCErrorType ParseIceServers(
if (!server.urls.empty()) {
for (const std::string& url : server.urls) {
if (url.empty()) {
RTC_LOG(LS_ERROR) << "Empty uri.";
RTC_LOG(LS_WARNING) << "Empty uri.";
return RTCErrorType::SYNTAX_ERROR;
}
RTCErrorType err =
@ -306,7 +306,7 @@ RTCErrorType ParseIceServers(
return err;
}
} else {
RTC_LOG(LS_ERROR) << "Empty uri.";
RTC_LOG(LS_WARNING) << "Empty uri.";
return RTCErrorType::SYNTAX_ERROR;
}
}

View File

@ -1458,7 +1458,7 @@ RTCError PeerConnection::SetConfiguration(
RTCErrorType parse_error =
ParseIceServers(configuration.servers, &stun_servers, &turn_servers);
if (parse_error != RTCErrorType::NONE) {
return RTCError(parse_error);
return RTCError(parse_error, "ICE server parse failed");
}
// Add the turn logging id to all turn servers
for (cricket::RelayServerConfig& turn_server : turn_servers) {