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

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

Issue 2187913002: Fixing invalid operator< implementation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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/client/basicportallocator_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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 dst_(socket->GetRemoteAddress()), 537 dst_(socket->GetRemoteAddress()),
538 proto_(proto), 538 proto_(proto),
539 socket_(socket) { 539 socket_(socket) {
540 } 540 }
541 541
542 bool TurnServerConnection::operator==(const TurnServerConnection& c) const { 542 bool TurnServerConnection::operator==(const TurnServerConnection& c) const {
543 return src_ == c.src_ && dst_ == c.dst_ && proto_ == c.proto_; 543 return src_ == c.src_ && dst_ == c.dst_ && proto_ == c.proto_;
544 } 544 }
545 545
546 bool TurnServerConnection::operator<(const TurnServerConnection& c) const { 546 bool TurnServerConnection::operator<(const TurnServerConnection& c) const {
547 return src_ < c.src_ || dst_ < c.dst_ || proto_ < c.proto_; 547 if (src_ != c.src_) {
honghaiz3 2016/07/27 18:38:13 Probably this is a good place to use std::tie sinc
Taylor Brandstetter 2016/07/28 22:42:08 Good point! I didn't know about that. Done.
548 return src_ < c.src_;
honghaiz3 2016/07/27 18:38:13 Plus, could we add a test to make sure the operato
Taylor Brandstetter 2016/07/28 22:42:08 Done. It's hard to cover every possibility of oper
549 }
550
551 if (dst_ != c.dst_) {
552 return dst_ < c.dst_;
553 }
554
555 if (proto_ != c.proto_) {
556 return proto_ < c.proto_;
557 }
558
559 return false;
548 } 560 }
549 561
550 std::string TurnServerConnection::ToString() const { 562 std::string TurnServerConnection::ToString() const {
551 const char* const kProtos[] = { 563 const char* const kProtos[] = {
552 "unknown", "udp", "tcp", "ssltcp" 564 "unknown", "udp", "tcp", "ssltcp"
553 }; 565 };
554 std::ostringstream ost; 566 std::ostringstream ost;
555 ost << src_.ToString() << "-" << dst_.ToString() << ":"<< kProtos[proto_]; 567 ost << src_.ToString() << "-" << dst_.ToString() << ":"<< kProtos[proto_];
556 return ost.str(); 568 return ost.str();
557 } 569 }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 MSG_ALLOCATION_TIMEOUT); 963 MSG_ALLOCATION_TIMEOUT);
952 } 964 }
953 965
954 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) { 966 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) {
955 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT); 967 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT);
956 SignalDestroyed(this); 968 SignalDestroyed(this);
957 delete this; 969 delete this;
958 } 970 }
959 971
960 } // namespace cricket 972 } // namespace cricket
OLDNEW
« no previous file with comments | « no previous file | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698