diff options
author | buildbot@webrtc.org <buildbot@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-04-25 21:12:10 +0000 |
---|---|---|
committer | buildbot@webrtc.org <buildbot@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-04-25 21:12:10 +0000 |
commit | 9e526697c45315081e8f97cdc7567da8f5fa280b (patch) | |
tree | 83b282361a8e110314362a16bbccde26455f4897 /p2p | |
parent | dd0accf3b191dfe0d7fef84aab99d60ff7e3b8e0 (diff) | |
download | talk-9e526697c45315081e8f97cdc7567da8f5fa280b.tar.gz |
(Auto)update libjingle 65561104-> 65619249
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@5983 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'p2p')
-rw-r--r-- | p2p/base/port_unittest.cc | 46 | ||||
-rw-r--r-- | p2p/base/turnport.cc | 13 |
2 files changed, 43 insertions, 16 deletions
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc index 61a2f4e..d96861c 100644 --- a/p2p/base/port_unittest.cc +++ b/p2p/base/port_unittest.cc @@ -470,10 +470,17 @@ class PortTest : public testing::Test, public sigslot::has_slots<> { TurnPort* CreateTurnPort(const SocketAddress& addr, PacketSocketFactory* socket_factory, ProtocolType int_proto, ProtocolType ext_proto) { + return CreateTurnPort(addr, socket_factory, + int_proto, ext_proto, kTurnUdpIntAddr); + } + TurnPort* CreateTurnPort(const SocketAddress& addr, + PacketSocketFactory* socket_factory, + ProtocolType int_proto, ProtocolType ext_proto, + const talk_base::SocketAddress& server_addr) { TurnPort* port = TurnPort::Create(main_, socket_factory, &network_, addr.ipaddr(), 0, 0, username_, password_, ProtocolAddress( - kTurnUdpIntAddr, PROTO_UDP), + server_addr, PROTO_UDP), kRelayCredentials); port->SetIceProtocolType(ice_protocol_); return port; @@ -2168,20 +2175,39 @@ TEST_F(PortTest, TestCandidateFoundation) { EXPECT_NE(udpport2->Candidates()[0].foundation(), relayport->Candidates()[0].foundation()); // Verifying TURN candidate foundation. - talk_base::scoped_ptr<Port> turnport(CreateTurnPort( + talk_base::scoped_ptr<Port> turnport1(CreateTurnPort( kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); - turnport->PrepareAddress(); - ASSERT_EQ_WAIT(2U, turnport->Candidates().size(), kTimeout); - EXPECT_NE(turnport->Candidates()[0].foundation(), - turnport->Candidates()[1].foundation()); + turnport1->PrepareAddress(); + ASSERT_EQ_WAIT(2U, turnport1->Candidates().size(), kTimeout); + EXPECT_NE(turnport1->Candidates()[0].foundation(), + turnport1->Candidates()[1].foundation()); EXPECT_NE(udpport1->Candidates()[0].foundation(), - turnport->Candidates()[1].foundation()); + turnport1->Candidates()[1].foundation()); EXPECT_NE(udpport2->Candidates()[0].foundation(), - turnport->Candidates()[1].foundation()); + turnport1->Candidates()[1].foundation()); EXPECT_NE(stunport->Candidates()[0].foundation(), - turnport->Candidates()[1].foundation()); + turnport1->Candidates()[1].foundation()); EXPECT_EQ(stunport->Candidates()[0].foundation(), - turnport->Candidates()[0].foundation()); + turnport1->Candidates()[0].foundation()); + talk_base::scoped_ptr<Port> turnport2(CreateTurnPort( + kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP)); + turnport2->PrepareAddress(); + ASSERT_EQ_WAIT(2U, turnport2->Candidates().size(), kTimeout); + EXPECT_EQ(turnport1->Candidates()[1].foundation(), + turnport2->Candidates()[1].foundation()); + + // Running a second turn server, to get different base IP address. + SocketAddress kTurnUdpIntAddr2("99.99.98.4", STUN_SERVER_PORT); + SocketAddress kTurnUdpExtAddr2("99.99.98.5", 0); + TestTurnServer turn_server2( + talk_base::Thread::Current(), kTurnUdpIntAddr2, kTurnUdpExtAddr2); + talk_base::scoped_ptr<Port> turnport3(CreateTurnPort( + kLocalAddr1, nat_socket_factory1(), PROTO_UDP, PROTO_UDP, + kTurnUdpIntAddr2)); + turnport3->PrepareAddress(); + ASSERT_EQ_WAIT(2U, turnport3->Candidates().size(), kTimeout); + EXPECT_NE(turnport3->Candidates()[1].foundation(), + turnport2->Candidates()[1].foundation()); } // This test verifies the related addresses of different types of diff --git a/p2p/base/turnport.cc b/p2p/base/turnport.cc index 7fe695e..cb40dc8 100644 --- a/p2p/base/turnport.cc +++ b/p2p/base/turnport.cc @@ -482,9 +482,9 @@ void TurnPort::OnSendStunPacket(const void* data, size_t size, void TurnPort::OnStunAddress(const talk_base::SocketAddress& address) { if (server_address_.proto == PROTO_UDP && address != socket_->GetLocalAddress()) { - AddAddress(address, - socket_->GetLocalAddress(), - socket_->GetLocalAddress(), + AddAddress(address, // Candidate address. + socket_->GetLocalAddress(), // Base address. + socket_->GetLocalAddress(), // Related address. UDP_PROTOCOL_NAME, STUN_PORT_TYPE, ICE_TYPE_PREFERENCE_SRFLX, @@ -494,10 +494,11 @@ void TurnPort::OnStunAddress(const talk_base::SocketAddress& address) { void TurnPort::OnAllocateSuccess(const talk_base::SocketAddress& address, const talk_base::SocketAddress& stun_address) { + // For relayed candidate, Base is the candidate itself. connected_ = true; - AddAddress(address, - socket_->GetLocalAddress(), - stun_address, + AddAddress(address, // Candidate Address + address, // Base Address + stun_address, // Related address. UDP_PROTOCOL_NAME, RELAY_PORT_TYPE, GetRelayPreference(server_address_.proto, server_address_.secure), |