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

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

Issue 2625003003: Replace ASSERT(false) by RTC_NOTREACHED(). (Closed)
Patch Set: Created 3 years, 11 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 | « webrtc/p2p/base/port.h ('k') | webrtc/p2p/base/pseudotcp.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
11 #include "webrtc/p2p/base/port.h" 11 #include "webrtc/p2p/base/port.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/p2p/base/common.h" 16 #include "webrtc/p2p/base/common.h"
17 #include "webrtc/p2p/base/portallocator.h" 17 #include "webrtc/p2p/base/portallocator.h"
18 #include "webrtc/base/base64.h" 18 #include "webrtc/base/base64.h"
19 #include "webrtc/base/checks.h"
19 #include "webrtc/base/crc32.h" 20 #include "webrtc/base/crc32.h"
20 #include "webrtc/base/helpers.h" 21 #include "webrtc/base/helpers.h"
21 #include "webrtc/base/logging.h" 22 #include "webrtc/base/logging.h"
22 #include "webrtc/base/messagedigest.h" 23 #include "webrtc/base/messagedigest.h"
23 #include "webrtc/base/network.h" 24 #include "webrtc/base/network.h"
24 #include "webrtc/base/stringencode.h" 25 #include "webrtc/base/stringencode.h"
25 #include "webrtc/base/stringutils.h" 26 #include "webrtc/base/stringutils.h"
26 27
27 namespace { 28 namespace {
28 29
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 SignalRoleConflict(this); 532 SignalRoleConflict(this);
532 } else { 533 } else {
533 // Send Role Conflict (487) error response. 534 // Send Role Conflict (487) error response.
534 SendBindingErrorResponse(stun_msg, addr, 535 SendBindingErrorResponse(stun_msg, addr,
535 STUN_ERROR_ROLE_CONFLICT, STUN_ERROR_REASON_ROLE_CONFLICT); 536 STUN_ERROR_ROLE_CONFLICT, STUN_ERROR_REASON_ROLE_CONFLICT);
536 ret = false; 537 ret = false;
537 } 538 }
538 } 539 }
539 break; 540 break;
540 default: 541 default:
541 ASSERT(false); 542 RTC_NOTREACHED();
542 } 543 }
543 return ret; 544 return ret;
544 } 545 }
545 546
546 void Port::CreateStunUsername(const std::string& remote_username, 547 void Port::CreateStunUsername(const std::string& remote_username,
547 std::string* stun_username_attr_str) const { 548 std::string* stun_username_attr_str) const {
548 stun_username_attr_str->clear(); 549 stun_username_attr_str->clear();
549 *stun_username_attr_str = remote_username; 550 *stun_username_attr_str = remote_username;
550 stun_username_attr_str->append(":"); 551 stun_username_attr_str->append(":");
551 stun_username_attr_str->append(username_fragment()); 552 stun_username_attr_str->append(username_fragment());
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 785 }
785 if (connection_->nomination() && 786 if (connection_->nomination() &&
786 connection_->nomination() != connection_->acked_nomination()) { 787 connection_->nomination() != connection_->acked_nomination()) {
787 request->AddAttribute(new StunUInt32Attribute( 788 request->AddAttribute(new StunUInt32Attribute(
788 STUN_ATTR_NOMINATION, connection_->nomination())); 789 STUN_ATTR_NOMINATION, connection_->nomination()));
789 } 790 }
790 } else if (connection_->port()->GetIceRole() == ICEROLE_CONTROLLED) { 791 } else if (connection_->port()->GetIceRole() == ICEROLE_CONTROLLED) {
791 request->AddAttribute(new StunUInt64Attribute( 792 request->AddAttribute(new StunUInt64Attribute(
792 STUN_ATTR_ICE_CONTROLLED, connection_->port()->IceTiebreaker())); 793 STUN_ATTR_ICE_CONTROLLED, connection_->port()->IceTiebreaker()));
793 } else { 794 } else {
794 ASSERT(false); 795 RTC_NOTREACHED();
795 } 796 }
796 797
797 // Adding PRIORITY Attribute. 798 // Adding PRIORITY Attribute.
798 // Changing the type preference to Peer Reflexive and local preference 799 // Changing the type preference to Peer Reflexive and local preference
799 // and component id information is unchanged from the original priority. 800 // and component id information is unchanged from the original priority.
800 // priority = (2^24)*(type preference) + 801 // priority = (2^24)*(type preference) +
801 // (2^8)*(local preference) + 802 // (2^8)*(local preference) +
802 // (2^0)*(256 - component ID) 803 // (2^0)*(256 - component ID)
803 uint32_t type_preference = 804 uint32_t type_preference =
804 (connection_->local_candidate().protocol() == TCP_PROTOCOL_NAME) 805 (connection_->local_candidate().protocol() == TCP_PROTOCOL_NAME)
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 break; 1033 break;
1033 1034
1034 // Remote end point sent an STUN indication instead of regular binding 1035 // Remote end point sent an STUN indication instead of regular binding
1035 // request. In this case |last_ping_received_| will be updated but no 1036 // request. In this case |last_ping_received_| will be updated but no
1036 // response will be sent. 1037 // response will be sent.
1037 case STUN_BINDING_INDICATION: 1038 case STUN_BINDING_INDICATION:
1038 ReceivedPing(); 1039 ReceivedPing();
1039 break; 1040 break;
1040 1041
1041 default: 1042 default:
1042 ASSERT(false); 1043 RTC_NOTREACHED();
1043 break; 1044 break;
1044 } 1045 }
1045 } 1046 }
1046 } 1047 }
1047 1048
1048 void Connection::HandleBindingRequest(IceMessage* msg) { 1049 void Connection::HandleBindingRequest(IceMessage* msg) {
1049 // This connection should now be receiving. 1050 // This connection should now be receiving.
1050 ReceivedPing(); 1051 ReceivedPing();
1051 1052
1052 const rtc::SocketAddress& remote_addr = remote_candidate_.address(); 1053 const rtc::SocketAddress& remote_addr = remote_candidate_.address();
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 ASSERT(sent < 0); 1583 ASSERT(sent < 0);
1583 error_ = port_->GetError(); 1584 error_ = port_->GetError();
1584 stats_.sent_discarded_packets++; 1585 stats_.sent_discarded_packets++;
1585 } else { 1586 } else {
1586 send_rate_tracker_.AddSamples(sent); 1587 send_rate_tracker_.AddSamples(sent);
1587 } 1588 }
1588 return sent; 1589 return sent;
1589 } 1590 }
1590 1591
1591 } // namespace cricket 1592 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port.h ('k') | webrtc/p2p/base/pseudotcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698