Commit 1b733b7f authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS PhoneHub] Correct ConnectionDetails::operator<()

Consider ConnectionDetails::connection_medium_ when comparing
ConnectionMedium objects. This fixes an issue in which two
ConnectionDetails objects with the same device ID but different mediums
were compared incorrectly, causing an issue where connection attempts to
the same device with different mediums ended up using the same
underlying connection instead of two separate connections.

Bug: 1150070
Change-Id: I9bb2802676aebf4a0df9a430cc33bff683dcd14e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2545664
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: James Vecore <vecore@google.com>
Reviewed-by: default avatarJames Vecore <vecore@google.com>
Cr-Commit-Position: refs/heads/master@{#828456}
parent 6a3cf69c
......@@ -4,6 +4,8 @@
#include "chromeos/services/secure_channel/connection_details.h"
#include <tuple>
#include "base/check.h"
#include "chromeos/components/multidevice/remote_device_ref.h"
......@@ -29,12 +31,8 @@ bool ConnectionDetails::operator!=(const ConnectionDetails& other) const {
}
bool ConnectionDetails::operator<(const ConnectionDetails& other) const {
if (device_id() != other.device_id())
return device_id() < other.device_id();
// Currently, there is only one ConnectionMedium type.
DCHECK(connection_medium() == other.connection_medium());
return false;
return std::tie(device_id_, connection_medium_) <
std::tie(other.device_id_, other.connection_medium_);
}
std::ostream& operator<<(std::ostream& stream,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment