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

Unified 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, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/p2p/client/basicportallocator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/turnserver.cc
diff --git a/webrtc/p2p/base/turnserver.cc b/webrtc/p2p/base/turnserver.cc
index dac7e38184247aba998e3093475f7cd39f1150a4..4464c761ee2d5f1f780aa6b49adbdfc3bb9b706e 100644
--- a/webrtc/p2p/base/turnserver.cc
+++ b/webrtc/p2p/base/turnserver.cc
@@ -544,7 +544,19 @@ bool TurnServerConnection::operator==(const TurnServerConnection& c) const {
}
bool TurnServerConnection::operator<(const TurnServerConnection& c) const {
- return src_ < c.src_ || dst_ < c.dst_ || proto_ < c.proto_;
+ 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.
+ 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
+ }
+
+ if (dst_ != c.dst_) {
+ return dst_ < c.dst_;
+ }
+
+ if (proto_ != c.proto_) {
+ return proto_ < c.proto_;
+ }
+
+ return false;
}
std::string TurnServerConnection::ToString() const {
« 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