| Index: webrtc/p2p/base/candidate.h
|
| diff --git a/webrtc/p2p/base/candidate.h b/webrtc/p2p/base/candidate.h
|
| index 11481cdb05a972db4237d3ef961cea6b0bc7e066..4ab1b6f2356daecbc900deedff8c5e72644f392f 100644
|
| --- a/webrtc/p2p/base/candidate.h
|
| +++ b/webrtc/p2p/base/candidate.h
|
| @@ -27,7 +27,7 @@
|
|
|
| namespace cricket {
|
|
|
| -const uint32_t kMaxNetworkCost = 999;
|
| +const uint16_t kMaxNetworkCost = 999;
|
|
|
| // Candidate for ICE based connection discovery.
|
|
|
| @@ -40,7 +40,9 @@ class Candidate {
|
| component_(0),
|
| priority_(0),
|
| network_type_(rtc::ADAPTER_TYPE_UNKNOWN),
|
| - generation_(0) {}
|
| + generation_(0),
|
| + network_id_(0),
|
| + network_cost_(0) {}
|
|
|
| Candidate(int component,
|
| const std::string& protocol,
|
| @@ -50,7 +52,9 @@ class Candidate {
|
| const std::string& password,
|
| const std::string& type,
|
| uint32_t generation,
|
| - const std::string& foundation)
|
| + const std::string& foundation,
|
| + uint16_t network_id = 0,
|
| + uint16_t network_cost = 0)
|
| : id_(rtc::CreateRandomString(8)),
|
| component_(component),
|
| protocol_(protocol),
|
| @@ -61,7 +65,9 @@ class Candidate {
|
| type_(type),
|
| network_type_(rtc::ADAPTER_TYPE_UNKNOWN),
|
| generation_(generation),
|
| - foundation_(foundation) {}
|
| + foundation_(foundation),
|
| + network_id_(network_id),
|
| + network_cost_(network_cost) {}
|
|
|
| const std::string & id() const { return id_; }
|
| void set_id(const std::string & id) { id_ = id; }
|
| @@ -143,11 +149,15 @@ class Candidate {
|
| // |network_cost| measures the cost/penalty of using this candidate. A network
|
| // cost of 0 indicates this candidate can be used freely. A value of
|
| // |kMaxNetworkCost| indicates it should be used only as the last resort.
|
| - void set_network_cost(uint32_t network_cost) {
|
| + void set_network_cost(uint16_t network_cost) {
|
| ASSERT(network_cost <= kMaxNetworkCost);
|
| network_cost_ = network_cost;
|
| }
|
| - uint32_t network_cost() const { return network_cost_; }
|
| + uint16_t network_cost() const { return network_cost_; }
|
| +
|
| + // An ID assigned to the network hosting the candidate.
|
| + uint16_t network_id() const { return network_id_; }
|
| + void set_network_id(uint16_t network_id) { network_id_ = network_id; }
|
|
|
| const std::string& foundation() const {
|
| return foundation_;
|
| @@ -178,13 +188,14 @@ class Candidate {
|
| // Determines whether this candidate is equivalent to the given one.
|
| bool IsEquivalent(const Candidate& c) const {
|
| // We ignore the network name, since that is just debug information, and
|
| - // the priority, since that should be the same if the rest is (and it's
|
| - // a float so equality checking is always worrisome).
|
| + // the priority and the network cost, since they should be the same if the
|
| + // rest are.
|
| return (component_ == c.component_) && (protocol_ == c.protocol_) &&
|
| (address_ == c.address_) && (username_ == c.username_) &&
|
| (password_ == c.password_) && (type_ == c.type_) &&
|
| (generation_ == c.generation_) && (foundation_ == c.foundation_) &&
|
| - (related_address_ == c.related_address_);
|
| + (related_address_ == c.related_address_) &&
|
| + (network_id_ == c.network_id_);
|
| }
|
|
|
| // Determines whether this candidate can be considered equivalent to the
|
| @@ -238,7 +249,7 @@ class Candidate {
|
| ost << "Cand[" << transport_name_ << ":" << foundation_ << ":" << component_
|
| << ":" << protocol_ << ":" << priority_ << ":" << address << ":"
|
| << type_ << ":" << related_address_ << ":" << username_ << ":"
|
| - << password_ << ":" << network_cost_ << "]";
|
| + << password_ << ":" << network_id_ << ":" << network_cost_ << "]";
|
| return ost.str();
|
| }
|
|
|
| @@ -257,8 +268,9 @@ class Candidate {
|
| std::string foundation_;
|
| rtc::SocketAddress related_address_;
|
| std::string tcptype_;
|
| - uint32_t network_cost_ = 0;
|
| std::string transport_name_;
|
| + uint16_t network_id_;
|
| + uint16_t network_cost_;
|
| };
|
|
|
| // Used during parsing and writing to map component to channel name
|
|
|