OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |