summaryrefslogtreecommitdiff
path: root/p2p
diff options
context:
space:
mode:
authorwu@webrtc.org <wu@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-02-13 19:54:28 +0000
committerwu@webrtc.org <wu@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d>2014-02-13 19:54:28 +0000
commitf5b8e7a761959709cf8201685deaf35ed074cb83 (patch)
tree23a32f3a6e7656b94e2b01f872e21933473c7755 /p2p
parent195a757a0e2513706e8622b4c7ab0d57bd993b80 (diff)
downloadtalk-f5b8e7a761959709cf8201685deaf35ed074cb83.tar.gz
Revert 5545 "Update libjingle to 61514460"
> Update libjingle to 61514460 > > TBR=tommi@webrtc.org > > Review URL: https://webrtc-codereview.appspot.com/8649004 TBR=xians@webrtc.org Review URL: https://webrtc-codereview.appspot.com/8669004 git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@5547 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'p2p')
-rw-r--r--p2p/base/candidate.h28
-rw-r--r--p2p/base/p2ptransportchannel.cc3
-rw-r--r--p2p/base/p2ptransportchannel_unittest.cc5
-rw-r--r--p2p/base/port.cc2
-rw-r--r--p2p/client/portallocator_unittest.cc19
5 files changed, 9 insertions, 48 deletions
diff --git a/p2p/base/candidate.h b/p2p/base/candidate.h
index 0fa9f0e..19eed8c 100644
--- a/p2p/base/candidate.h
+++ b/p2p/base/candidate.h
@@ -33,7 +33,6 @@
#include <string>
#include <sstream>
#include <iomanip>
-
#include "talk/base/basictypes.h"
#include "talk/base/socketaddress.h"
#include "talk/p2p/base/constants.h"
@@ -164,30 +163,13 @@ class Candidate {
return ToStringInternal(true);
}
- uint32 GetPriority(uint32 type_preference,
- int network_adapter_preference) const {
+ uint32 GetPriority(uint32 type_preference) const {
// RFC 5245 - 4.1.2.1.
// priority = (2^24)*(type preference) +
// (2^8)*(local preference) +
// (2^0)*(256 - component ID)
-
- // |local_preference| length is 2 bytes, 0-65535 inclusive.
- // In our implemenation we will partion local_preference into
- // 0 1
- // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- // | NIC Pref | Addr Pref |
- // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- // NIC Type - Type of the network adapter e.g. 3G/Wifi/Wired.
- // Addr Pref - Address preference value as per RFC 3484.
- // local preference is calculated as - NIC Type << 8 | Addr_Pref.
-
int addr_pref = IPAddressPrecedence(address_.ipaddr());
- int local_preference = (network_adapter_preference << 8) | addr_pref;
-
- return (type_preference << 24) |
- (local_preference << 8) |
- (256 - component_);
+ return (type_preference << 24) | (addr_pref << 8) | (256 - component_);
}
private:
@@ -195,9 +177,9 @@ class Candidate {
std::ostringstream ost;
std::string address = sensitive ? address_.ToSensitiveString() :
address_.ToString();
- ost << "Cand[" << foundation_ << ":" << component_ << ":"
- << protocol_ << ":" << priority_ << ":"
- << address << ":" << type_ << ":" << related_address_ << ":"
+ ost << "Cand[" << id_ << ":" << component_ << ":"
+ << type_ << ":" << protocol_ << ":"
+ << network_name_ << ":" << address << ":"
<< username_ << ":" << password_ << "]";
return ost.str();
}
diff --git a/p2p/base/p2ptransportchannel.cc b/p2p/base/p2ptransportchannel.cc
index 1f53874..104b5e6 100644
--- a/p2p/base/p2ptransportchannel.cc
+++ b/p2p/base/p2ptransportchannel.cc
@@ -493,8 +493,7 @@ void P2PTransportChannel::OnUnknownAddress(
port->Network()->name(), 0U,
talk_base::ToString<uint32>(talk_base::ComputeCrc32(id)));
new_remote_candidate.set_priority(
- new_remote_candidate.GetPriority(ICE_TYPE_PREFERENCE_SRFLX,
- port->Network()->preference()));
+ new_remote_candidate.GetPriority(ICE_TYPE_PREFERENCE_SRFLX));
}
if (port->IceProtocol() == ICEPROTO_RFC5245) {
diff --git a/p2p/base/p2ptransportchannel_unittest.cc b/p2p/base/p2ptransportchannel_unittest.cc
index 53a39c2..7fff3da 100644
--- a/p2p/base/p2ptransportchannel_unittest.cc
+++ b/p2p/base/p2ptransportchannel_unittest.cc
@@ -1559,11 +1559,8 @@ TEST_F(P2PTransportChannelMultihomedTest, DISABLED_TestBasic) {
// Test that we can quickly switch links if an interface goes down.
TEST_F(P2PTransportChannelMultihomedTest, TestFailover) {
AddAddress(0, kPublicAddrs[0]);
- // Adding alternate address will make sure |kPublicAddrs| has the higher
- // priority than others. This is due to FakeNetwork::AddInterface method.
- AddAddress(1, kAlternateAddrs[1]);
AddAddress(1, kPublicAddrs[1]);
-
+ AddAddress(1, kAlternateAddrs[1]);
// Use only local ports for simplicity.
SetAllocatorFlags(0, kOnlyLocalPorts);
SetAllocatorFlags(1, kOnlyLocalPorts);
diff --git a/p2p/base/port.cc b/p2p/base/port.cc
index 38031cb..b6421ad 100644
--- a/p2p/base/port.cc
+++ b/p2p/base/port.cc
@@ -258,7 +258,7 @@ void Port::AddAddress(const talk_base::SocketAddress& address,
c.set_type(type);
c.set_protocol(protocol);
c.set_address(address);
- c.set_priority(c.GetPriority(type_preference, network_->preference()));
+ c.set_priority(c.GetPriority(type_preference));
c.set_username(username_fragment());
c.set_password(password_);
c.set_network_name(network_->name());
diff --git a/p2p/client/portallocator_unittest.cc b/p2p/client/portallocator_unittest.cc
index 0ea8fb5..1417707 100644
--- a/p2p/client/portallocator_unittest.cc
+++ b/p2p/client/portallocator_unittest.cc
@@ -53,8 +53,8 @@ using talk_base::Thread;
static const SocketAddress kClientAddr("11.11.11.11", 0);
static const SocketAddress kClientIPv6Addr(
"2401:fa00:4:1000:be30:5bff:fee5:c3", 0);
-static const SocketAddress kClientAddr2("22.22.22.22", 0);
static const SocketAddress kNatAddr("77.77.77.77", talk_base::NAT_SERVER_PORT);
+static const SocketAddress kRemoteClientAddr("22.22.22.22", 0);
static const SocketAddress kStunAddr("99.99.99.1", cricket::STUN_SERVER_PORT);
static const SocketAddress kRelayUdpIntAddr("99.99.99.2", 5000);
static const SocketAddress kRelayUdpExtAddr("99.99.99.3", 5001);
@@ -492,23 +492,6 @@ TEST_F(PortAllocatorTest, TestGetAllPortsNoUdpAllowed) {
EXPECT_TRUE_WAIT(candidate_allocation_done_, 9000);
}
-TEST_F(PortAllocatorTest, TestCandidatePriorityOfMultipleInterfaces) {
- AddInterface(kClientAddr);
- AddInterface(kClientAddr2);
- // Allocating only host UDP ports. This is done purely for testing
- // convenience.
- allocator().set_flags(cricket::PORTALLOCATOR_DISABLE_TCP |
- cricket::PORTALLOCATOR_DISABLE_STUN |
- cricket::PORTALLOCATOR_DISABLE_RELAY);
- EXPECT_TRUE(CreateSession(cricket::ICE_CANDIDATE_COMPONENT_RTP));
- session_->StartGettingPorts();
- EXPECT_TRUE_WAIT(candidate_allocation_done_, kDefaultAllocationTimeout);
- ASSERT_EQ(2U, candidates_.size());
- EXPECT_EQ(2U, ports_.size());
- // Candidates priorities should be different.
- EXPECT_NE(candidates_[0].priority(), candidates_[1].priority());
-}
-
// Test to verify ICE restart process.
TEST_F(PortAllocatorTest, TestGetAllPortsRestarts) {
AddInterface(kClientAddr);