Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: webrtc/pc/peerconnection.cc

Issue 2680023005: Clarifying error messages in ParseIceServerUrl for invalid transport parameters. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/pc/peerconnection_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 rtc::tokenize_with_empty_tokens(url, '?', &tokens); 238 rtc::tokenize_with_empty_tokens(url, '?', &tokens);
239 std::string uri_without_transport = tokens[0]; 239 std::string uri_without_transport = tokens[0];
240 // Let's look into transport= param, if it exists. 240 // Let's look into transport= param, if it exists.
241 if (tokens.size() == kTurnTransportTokensNum) { // ?transport= is present. 241 if (tokens.size() == kTurnTransportTokensNum) { // ?transport= is present.
242 std::string uri_transport_param = tokens[1]; 242 std::string uri_transport_param = tokens[1];
243 rtc::tokenize_with_empty_tokens(uri_transport_param, '=', &tokens); 243 rtc::tokenize_with_empty_tokens(uri_transport_param, '=', &tokens);
244 if (tokens[0] != kTransport) { 244 if (tokens[0] != kTransport) {
245 LOG(LS_WARNING) << "Invalid transport parameter key."; 245 LOG(LS_WARNING) << "Invalid transport parameter key.";
246 return RTCErrorType::SYNTAX_ERROR; 246 return RTCErrorType::SYNTAX_ERROR;
247 } 247 }
248 if (tokens.size() < 2 || 248 if (tokens.size() < 2) {
249 !cricket::StringToProto(tokens[1].c_str(), &turn_transport_type) || 249 LOG(LS_WARNING) << "Transport parameter missing value.";
250 return RTCErrorType::SYNTAX_ERROR;
251 }
252 if (!cricket::StringToProto(tokens[1].c_str(), &turn_transport_type) ||
250 (turn_transport_type != cricket::PROTO_UDP && 253 (turn_transport_type != cricket::PROTO_UDP &&
251 turn_transport_type != cricket::PROTO_TCP)) { 254 turn_transport_type != cricket::PROTO_TCP)) {
252 LOG(LS_WARNING) << "Transport param should always be udp or tcp."; 255 LOG(LS_WARNING) << "Transport parameter should always be udp or tcp.";
253 return RTCErrorType::SYNTAX_ERROR; 256 return RTCErrorType::SYNTAX_ERROR;
254 } 257 }
255 } 258 }
256 259
257 std::string hoststring; 260 std::string hoststring;
258 ServiceType service_type; 261 ServiceType service_type;
259 if (!GetServiceTypeAndHostnameFromUri(uri_without_transport, 262 if (!GetServiceTypeAndHostnameFromUri(uri_without_transport,
260 &service_type, 263 &service_type,
261 &hoststring)) { 264 &hoststring)) {
262 LOG(LS_WARNING) << "Invalid transport parameter in ICE URI: " << url; 265 LOG(LS_WARNING) << "Invalid transport parameter in ICE URI: " << url;
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 2573
2571 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, 2574 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
2572 int64_t max_size_bytes) { 2575 int64_t max_size_bytes) {
2573 return event_log_->StartLogging(file, max_size_bytes); 2576 return event_log_->StartLogging(file, max_size_bytes);
2574 } 2577 }
2575 2578
2576 void PeerConnection::StopRtcEventLog_w() { 2579 void PeerConnection::StopRtcEventLog_w() {
2577 event_log_->StopLogging(); 2580 event_log_->StopLogging();
2578 } 2581 }
2579 } // namespace webrtc 2582 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/pc/peerconnection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698