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

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 | « webrtc/BUILD.gn ('k') | webrtc/p2p/base/turnserver_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
11 #include "webrtc/p2p/base/turnserver.h" 11 #include "webrtc/p2p/base/turnserver.h"
12 12
13 #include <tuple> // for std::tie
14
13 #include "webrtc/p2p/base/asyncstuntcpsocket.h" 15 #include "webrtc/p2p/base/asyncstuntcpsocket.h"
14 #include "webrtc/p2p/base/common.h" 16 #include "webrtc/p2p/base/common.h"
15 #include "webrtc/p2p/base/packetsocketfactory.h" 17 #include "webrtc/p2p/base/packetsocketfactory.h"
16 #include "webrtc/p2p/base/stun.h" 18 #include "webrtc/p2p/base/stun.h"
17 #include "webrtc/base/bytebuffer.h" 19 #include "webrtc/base/bytebuffer.h"
18 #include "webrtc/base/helpers.h" 20 #include "webrtc/base/helpers.h"
19 #include "webrtc/base/logging.h" 21 #include "webrtc/base/logging.h"
20 #include "webrtc/base/messagedigest.h" 22 #include "webrtc/base/messagedigest.h"
21 #include "webrtc/base/socketadapters.h" 23 #include "webrtc/base/socketadapters.h"
22 #include "webrtc/base/stringencode.h" 24 #include "webrtc/base/stringencode.h"
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 dst_(socket->GetRemoteAddress()), 539 dst_(socket->GetRemoteAddress()),
538 proto_(proto), 540 proto_(proto),
539 socket_(socket) { 541 socket_(socket) {
540 } 542 }
541 543
542 bool TurnServerConnection::operator==(const TurnServerConnection& c) const { 544 bool TurnServerConnection::operator==(const TurnServerConnection& c) const {
543 return src_ == c.src_ && dst_ == c.dst_ && proto_ == c.proto_; 545 return src_ == c.src_ && dst_ == c.dst_ && proto_ == c.proto_;
544 } 546 }
545 547
546 bool TurnServerConnection::operator<(const TurnServerConnection& c) const { 548 bool TurnServerConnection::operator<(const TurnServerConnection& c) const {
547 return src_ < c.src_ || dst_ < c.dst_ || proto_ < c.proto_; 549 return std::tie(src_, dst_, proto_) < std::tie(c.src_, c.dst_, c.proto_);
548 } 550 }
549 551
550 std::string TurnServerConnection::ToString() const { 552 std::string TurnServerConnection::ToString() const {
551 const char* const kProtos[] = { 553 const char* const kProtos[] = {
552 "unknown", "udp", "tcp", "ssltcp" 554 "unknown", "udp", "tcp", "ssltcp"
553 }; 555 };
554 std::ostringstream ost; 556 std::ostringstream ost;
555 ost << src_.ToString() << "-" << dst_.ToString() << ":"<< kProtos[proto_]; 557 ost << src_.ToString() << "-" << dst_.ToString() << ":"<< kProtos[proto_];
556 return ost.str(); 558 return ost.str();
557 } 559 }
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 MSG_ALLOCATION_TIMEOUT); 953 MSG_ALLOCATION_TIMEOUT);
952 } 954 }
953 955
954 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) { 956 void TurnServerAllocation::Channel::OnMessage(rtc::Message* msg) {
955 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT); 957 ASSERT(msg->message_id == MSG_ALLOCATION_TIMEOUT);
956 SignalDestroyed(this); 958 SignalDestroyed(this);
957 delete this; 959 delete this;
958 } 960 }
959 961
960 } // namespace cricket 962 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/BUILD.gn ('k') | webrtc/p2p/base/turnserver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698