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

Side by Side Diff: webrtc/p2p/base/port.cc

Issue 2837133003: Don't crash if STUN error message is missing ERROR-CODE attribute. (Closed)
Patch Set: Created 3 years, 8 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/p2p/base/relayport.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 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 int64_t time_received = rtc::TimeMillis(); 1404 int64_t time_received = rtc::TimeMillis();
1405 packet_loss_estimator_.ReceivedResponse(request->id(), time_received); 1405 packet_loss_estimator_.ReceivedResponse(request->id(), time_received);
1406 1406
1407 stats_.recv_ping_responses++; 1407 stats_.recv_ping_responses++;
1408 1408
1409 MaybeUpdateLocalCandidate(request, response); 1409 MaybeUpdateLocalCandidate(request, response);
1410 } 1410 }
1411 1411
1412 void Connection::OnConnectionRequestErrorResponse(ConnectionRequest* request, 1412 void Connection::OnConnectionRequestErrorResponse(ConnectionRequest* request,
1413 StunMessage* response) { 1413 StunMessage* response) {
1414 const StunErrorCodeAttribute* error_attr = response->GetErrorCode(); 1414 int error_code = response->GetErrorCodeValue();
1415 int error_code = STUN_ERROR_GLOBAL_FAILURE;
1416 if (error_attr) {
1417 error_code = error_attr->code();
1418 }
1419
1420 LOG_J(LS_INFO, this) << "Received STUN error response" 1415 LOG_J(LS_INFO, this) << "Received STUN error response"
1421 << " id=" << rtc::hex_encode(request->id()) 1416 << " id=" << rtc::hex_encode(request->id())
1422 << " code=" << error_code 1417 << " code=" << error_code
1423 << " rtt=" << request->Elapsed(); 1418 << " rtt=" << request->Elapsed();
1424 1419
1425 if (error_code == STUN_ERROR_UNKNOWN_ATTRIBUTE || 1420 if (error_code == STUN_ERROR_UNKNOWN_ATTRIBUTE ||
1426 error_code == STUN_ERROR_SERVER_ERROR || 1421 error_code == STUN_ERROR_SERVER_ERROR ||
1427 error_code == STUN_ERROR_UNAUTHORIZED) { 1422 error_code == STUN_ERROR_UNAUTHORIZED) {
1428 // Recoverable error, retry 1423 // Recoverable error, retry
1429 } else if (error_code == STUN_ERROR_STALE_CREDENTIALS) { 1424 } else if (error_code == STUN_ERROR_STALE_CREDENTIALS) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 RTC_DCHECK(sent < 0); 1620 RTC_DCHECK(sent < 0);
1626 error_ = port_->GetError(); 1621 error_ = port_->GetError();
1627 stats_.sent_discarded_packets++; 1622 stats_.sent_discarded_packets++;
1628 } else { 1623 } else {
1629 send_rate_tracker_.AddSamples(sent); 1624 send_rate_tracker_.AddSamples(sent);
1630 } 1625 }
1631 return sent; 1626 return sent;
1632 } 1627 }
1633 1628
1634 } // namespace cricket 1629 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/base/relayport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698