| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 // Based on ICE_UFRAG_LENGTH | 87 // Based on ICE_UFRAG_LENGTH |
| 88 static const char* kIceUfrag[4] = {"TESTICEUFRAG0000", "TESTICEUFRAG0001", | 88 static const char* kIceUfrag[4] = {"TESTICEUFRAG0000", "TESTICEUFRAG0001", |
| 89 "TESTICEUFRAG0002", "TESTICEUFRAG0003"}; | 89 "TESTICEUFRAG0002", "TESTICEUFRAG0003"}; |
| 90 // Based on ICE_PWD_LENGTH | 90 // Based on ICE_PWD_LENGTH |
| 91 static const char* kIcePwd[4] = {"TESTICEPWD00000000000000", | 91 static const char* kIcePwd[4] = {"TESTICEPWD00000000000000", |
| 92 "TESTICEPWD00000000000001", | 92 "TESTICEPWD00000000000001", |
| 93 "TESTICEPWD00000000000002", | 93 "TESTICEPWD00000000000002", |
| 94 "TESTICEPWD00000000000003"}; | 94 "TESTICEPWD00000000000003"}; |
| 95 | 95 |
| 96 static const uint64 kTiebreaker1 = 11111; | 96 static const uint64_t kTiebreaker1 = 11111; |
| 97 static const uint64 kTiebreaker2 = 22222; | 97 static const uint64_t kTiebreaker2 = 22222; |
| 98 | 98 |
| 99 enum { | 99 enum { |
| 100 MSG_CANDIDATE | 100 MSG_CANDIDATE |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 static cricket::IceConfig CreateIceConfig(int receiving_timeout_ms, | 103 static cricket::IceConfig CreateIceConfig(int receiving_timeout_ms, |
| 104 bool gather_continually) { | 104 bool gather_continually) { |
| 105 cricket::IceConfig config; | 105 cricket::IceConfig config; |
| 106 config.receiving_timeout_ms = receiving_timeout_ms; | 106 config.receiving_timeout_ms = receiving_timeout_ms; |
| 107 config.gather_continually = gather_continually; | 107 config.gather_continually = gather_continually; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 ChannelData* GetChannelData(cricket::TransportChannel* ch) { | 232 ChannelData* GetChannelData(cricket::TransportChannel* ch) { |
| 233 if (!HasChannel(ch)) return NULL; | 233 if (!HasChannel(ch)) return NULL; |
| 234 if (cd1_.ch_.get() == ch) | 234 if (cd1_.ch_.get() == ch) |
| 235 return &cd1_; | 235 return &cd1_; |
| 236 else | 236 else |
| 237 return &cd2_; | 237 return &cd2_; |
| 238 } | 238 } |
| 239 | 239 |
| 240 void SetIceRole(cricket::IceRole role) { role_ = role; } | 240 void SetIceRole(cricket::IceRole role) { role_ = role; } |
| 241 cricket::IceRole ice_role() { return role_; } | 241 cricket::IceRole ice_role() { return role_; } |
| 242 void SetIceTiebreaker(uint64 tiebreaker) { tiebreaker_ = tiebreaker; } | 242 void SetIceTiebreaker(uint64_t tiebreaker) { tiebreaker_ = tiebreaker; } |
| 243 uint64 GetIceTiebreaker() { return tiebreaker_; } | 243 uint64_t GetIceTiebreaker() { return tiebreaker_; } |
| 244 void OnRoleConflict(bool role_conflict) { role_conflict_ = role_conflict; } | 244 void OnRoleConflict(bool role_conflict) { role_conflict_ = role_conflict; } |
| 245 bool role_conflict() { return role_conflict_; } | 245 bool role_conflict() { return role_conflict_; } |
| 246 void SetAllocationStepDelay(uint32 delay) { | 246 void SetAllocationStepDelay(uint32_t delay) { |
| 247 allocator_->set_step_delay(delay); | 247 allocator_->set_step_delay(delay); |
| 248 } | 248 } |
| 249 void SetAllowTcpListen(bool allow_tcp_listen) { | 249 void SetAllowTcpListen(bool allow_tcp_listen) { |
| 250 allocator_->set_allow_tcp_listen(allow_tcp_listen); | 250 allocator_->set_allow_tcp_listen(allow_tcp_listen); |
| 251 } | 251 } |
| 252 | 252 |
| 253 rtc::FakeNetworkManager network_manager_; | 253 rtc::FakeNetworkManager network_manager_; |
| 254 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; | 254 rtc::scoped_ptr<cricket::BasicPortAllocator> allocator_; |
| 255 ChannelData cd1_; | 255 ChannelData cd1_; |
| 256 ChannelData cd2_; | 256 ChannelData cd2_; |
| 257 cricket::IceRole role_; | 257 cricket::IceRole role_; |
| 258 uint64 tiebreaker_; | 258 uint64_t tiebreaker_; |
| 259 bool role_conflict_; | 259 bool role_conflict_; |
| 260 bool save_candidates_; | 260 bool save_candidates_; |
| 261 std::vector<CandidateData*> saved_candidates_; | 261 std::vector<CandidateData*> saved_candidates_; |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 ChannelData* GetChannelData(cricket::TransportChannel* channel) { | 264 ChannelData* GetChannelData(cricket::TransportChannel* channel) { |
| 265 if (ep1_.HasChannel(channel)) | 265 if (ep1_.HasChannel(channel)) |
| 266 return ep1_.GetChannelData(channel); | 266 return ep1_.GetChannelData(channel); |
| 267 else | 267 else |
| 268 return ep2_.GetChannelData(channel); | 268 return ep2_.GetChannelData(channel); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 info.address = (type == rtc::PROXY_HTTPS) ? | 375 info.address = (type == rtc::PROXY_HTTPS) ? |
| 376 kHttpsProxyAddrs[endpoint] : kSocksProxyAddrs[endpoint]; | 376 kHttpsProxyAddrs[endpoint] : kSocksProxyAddrs[endpoint]; |
| 377 GetAllocator(endpoint)->set_proxy("unittest/1.0", info); | 377 GetAllocator(endpoint)->set_proxy("unittest/1.0", info); |
| 378 } | 378 } |
| 379 void SetAllocatorFlags(int endpoint, int flags) { | 379 void SetAllocatorFlags(int endpoint, int flags) { |
| 380 GetAllocator(endpoint)->set_flags(flags); | 380 GetAllocator(endpoint)->set_flags(flags); |
| 381 } | 381 } |
| 382 void SetIceRole(int endpoint, cricket::IceRole role) { | 382 void SetIceRole(int endpoint, cricket::IceRole role) { |
| 383 GetEndpoint(endpoint)->SetIceRole(role); | 383 GetEndpoint(endpoint)->SetIceRole(role); |
| 384 } | 384 } |
| 385 void SetIceTiebreaker(int endpoint, uint64 tiebreaker) { | 385 void SetIceTiebreaker(int endpoint, uint64_t tiebreaker) { |
| 386 GetEndpoint(endpoint)->SetIceTiebreaker(tiebreaker); | 386 GetEndpoint(endpoint)->SetIceTiebreaker(tiebreaker); |
| 387 } | 387 } |
| 388 bool GetRoleConflict(int endpoint) { | 388 bool GetRoleConflict(int endpoint) { |
| 389 return GetEndpoint(endpoint)->role_conflict(); | 389 return GetEndpoint(endpoint)->role_conflict(); |
| 390 } | 390 } |
| 391 void SetAllocationStepDelay(int endpoint, uint32 delay) { | 391 void SetAllocationStepDelay(int endpoint, uint32_t delay) { |
| 392 return GetEndpoint(endpoint)->SetAllocationStepDelay(delay); | 392 return GetEndpoint(endpoint)->SetAllocationStepDelay(delay); |
| 393 } | 393 } |
| 394 void SetAllowTcpListen(int endpoint, bool allow_tcp_listen) { | 394 void SetAllowTcpListen(int endpoint, bool allow_tcp_listen) { |
| 395 return GetEndpoint(endpoint)->SetAllowTcpListen(allow_tcp_listen); | 395 return GetEndpoint(endpoint)->SetAllowTcpListen(allow_tcp_listen); |
| 396 } | 396 } |
| 397 bool IsLocalToPrflxOrTheReverse(const Result& expected) { | 397 bool IsLocalToPrflxOrTheReverse(const Result& expected) { |
| 398 return ( | 398 return ( |
| 399 (expected.local_type == "local" && expected.remote_type == "prflx") || | 399 (expected.local_type == "local" && expected.remote_type == "prflx") || |
| 400 (expected.local_type == "prflx" && expected.remote_type == "local")); | 400 (expected.local_type == "prflx" && expected.remote_type == "local")); |
| 401 } | 401 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 if (remote_type != expected.remote_type2) { | 484 if (remote_type != expected.remote_type2) { |
| 485 EXPECT_TRUE(expected.remote_type2 == cricket::LOCAL_PORT_TYPE || | 485 EXPECT_TRUE(expected.remote_type2 == cricket::LOCAL_PORT_TYPE || |
| 486 expected.remote_type2 == cricket::STUN_PORT_TYPE); | 486 expected.remote_type2 == cricket::STUN_PORT_TYPE); |
| 487 EXPECT_TRUE(remote_type == cricket::LOCAL_PORT_TYPE || | 487 EXPECT_TRUE(remote_type == cricket::LOCAL_PORT_TYPE || |
| 488 remote_type == cricket::STUN_PORT_TYPE || | 488 remote_type == cricket::STUN_PORT_TYPE || |
| 489 remote_type == cricket::PRFLX_PORT_TYPE); | 489 remote_type == cricket::PRFLX_PORT_TYPE); |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 | 492 |
| 493 void Test(const Result& expected) { | 493 void Test(const Result& expected) { |
| 494 int32 connect_start = rtc::Time(), connect_time; | 494 int32_t connect_start = rtc::Time(), connect_time; |
| 495 | 495 |
| 496 // Create the channels and wait for them to connect. | 496 // Create the channels and wait for them to connect. |
| 497 CreateChannels(1); | 497 CreateChannels(1); |
| 498 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && | 498 EXPECT_TRUE_WAIT_MARGIN(ep1_ch1() != NULL && |
| 499 ep2_ch1() != NULL && | 499 ep2_ch1() != NULL && |
| 500 ep1_ch1()->receiving() && | 500 ep1_ch1()->receiving() && |
| 501 ep1_ch1()->writable() && | 501 ep1_ch1()->writable() && |
| 502 ep2_ch1()->receiving() && | 502 ep2_ch1()->receiving() && |
| 503 ep2_ch1()->writable(), | 503 ep2_ch1()->writable(), |
| 504 expected.connect_wait, | 504 expected.connect_wait, |
| 505 1000); | 505 1000); |
| 506 connect_time = rtc::TimeSince(connect_start); | 506 connect_time = rtc::TimeSince(connect_start); |
| 507 if (connect_time < expected.connect_wait) { | 507 if (connect_time < expected.connect_wait) { |
| 508 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; | 508 LOG(LS_INFO) << "Connect time: " << connect_time << " ms"; |
| 509 } else { | 509 } else { |
| 510 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" | 510 LOG(LS_INFO) << "Connect time: " << "TIMEOUT (" |
| 511 << expected.connect_wait << " ms)"; | 511 << expected.connect_wait << " ms)"; |
| 512 } | 512 } |
| 513 | 513 |
| 514 // Allow a few turns of the crank for the best connections to emerge. | 514 // Allow a few turns of the crank for the best connections to emerge. |
| 515 // This may take up to 2 seconds. | 515 // This may take up to 2 seconds. |
| 516 if (ep1_ch1()->best_connection() && | 516 if (ep1_ch1()->best_connection() && |
| 517 ep2_ch1()->best_connection()) { | 517 ep2_ch1()->best_connection()) { |
| 518 int32 converge_start = rtc::Time(), converge_time; | 518 int32_t converge_start = rtc::Time(), converge_time; |
| 519 int converge_wait = 2000; | 519 int converge_wait = 2000; |
| 520 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait, | 520 EXPECT_TRUE_WAIT_MARGIN(CheckCandidate1(expected), converge_wait, |
| 521 converge_wait); | 521 converge_wait); |
| 522 // Also do EXPECT_EQ on each part so that failures are more verbose. | 522 // Also do EXPECT_EQ on each part so that failures are more verbose. |
| 523 ExpectCandidate1(expected); | 523 ExpectCandidate1(expected); |
| 524 | 524 |
| 525 // Verifying remote channel best connection information. This is done | 525 // Verifying remote channel best connection information. This is done |
| 526 // only for the RFC 5245 as controlled agent will use USE-CANDIDATE | 526 // only for the RFC 5245 as controlled agent will use USE-CANDIDATE |
| 527 // from controlling (ep1) agent. We can easily predict from EP1 result | 527 // from controlling (ep1) agent. We can easily predict from EP1 result |
| 528 // matrix. | 528 // matrix. |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); | 1800 cricket::FakePortAllocator pa(rtc::Thread::Current(), nullptr); |
| 1801 cricket::P2PTransportChannel ch("connection resurrection", 1, nullptr, &pa); | 1801 cricket::P2PTransportChannel ch("connection resurrection", 1, nullptr, &pa); |
| 1802 PrepareChannel(&ch); | 1802 PrepareChannel(&ch); |
| 1803 ch.Connect(); | 1803 ch.Connect(); |
| 1804 ch.MaybeStartGathering(); | 1804 ch.MaybeStartGathering(); |
| 1805 | 1805 |
| 1806 // Create conn1 and keep track of original candidate priority. | 1806 // Create conn1 and keep track of original candidate priority. |
| 1807 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); | 1807 ch.AddRemoteCandidate(CreateCandidate("1.1.1.1", 1, 1)); |
| 1808 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1808 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1809 ASSERT_TRUE(conn1 != nullptr); | 1809 ASSERT_TRUE(conn1 != nullptr); |
| 1810 uint32 remote_priority = conn1->remote_candidate().priority(); | 1810 uint32_t remote_priority = conn1->remote_candidate().priority(); |
| 1811 | 1811 |
| 1812 // Create a higher priority candidate and make the connection | 1812 // Create a higher priority candidate and make the connection |
| 1813 // receiving/writable. This will prune conn1. | 1813 // receiving/writable. This will prune conn1. |
| 1814 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 2)); | 1814 ch.AddRemoteCandidate(CreateCandidate("2.2.2.2", 2, 2)); |
| 1815 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); | 1815 cricket::Connection* conn2 = WaitForConnectionTo(&ch, "2.2.2.2", 2); |
| 1816 ASSERT_TRUE(conn2 != nullptr); | 1816 ASSERT_TRUE(conn2 != nullptr); |
| 1817 conn2->ReceivedPing(); | 1817 conn2->ReceivedPing(); |
| 1818 conn2->ReceivedPingResponse(); | 1818 conn2->ReceivedPingResponse(); |
| 1819 | 1819 |
| 1820 // Wait for conn1 to be pruned. | 1820 // Wait for conn1 to be pruned. |
| 1821 EXPECT_TRUE_WAIT(conn1->pruned(), 3000); | 1821 EXPECT_TRUE_WAIT(conn1->pruned(), 3000); |
| 1822 // Destroy the connection to test SignalUnknownAddress. | 1822 // Destroy the connection to test SignalUnknownAddress. |
| 1823 conn1->Destroy(); | 1823 conn1->Destroy(); |
| 1824 EXPECT_TRUE_WAIT(GetConnectionTo(&ch, "1.1.1.1", 1) == nullptr, 1000); | 1824 EXPECT_TRUE_WAIT(GetConnectionTo(&ch, "1.1.1.1", 1) == nullptr, 1000); |
| 1825 | 1825 |
| 1826 // Create a minimal STUN message with prflx priority. | 1826 // Create a minimal STUN message with prflx priority. |
| 1827 cricket::IceMessage request; | 1827 cricket::IceMessage request; |
| 1828 request.SetType(cricket::STUN_BINDING_REQUEST); | 1828 request.SetType(cricket::STUN_BINDING_REQUEST); |
| 1829 request.AddAttribute(new cricket::StunByteStringAttribute( | 1829 request.AddAttribute(new cricket::StunByteStringAttribute( |
| 1830 cricket::STUN_ATTR_USERNAME, kIceUfrag[1])); | 1830 cricket::STUN_ATTR_USERNAME, kIceUfrag[1])); |
| 1831 uint32 prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24; | 1831 uint32_t prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24; |
| 1832 request.AddAttribute(new cricket::StunUInt32Attribute( | 1832 request.AddAttribute(new cricket::StunUInt32Attribute( |
| 1833 cricket::STUN_ATTR_PRIORITY, prflx_priority)); | 1833 cricket::STUN_ATTR_PRIORITY, prflx_priority)); |
| 1834 EXPECT_NE(prflx_priority, remote_priority); | 1834 EXPECT_NE(prflx_priority, remote_priority); |
| 1835 | 1835 |
| 1836 cricket::Port* port = GetPort(&ch); | 1836 cricket::Port* port = GetPort(&ch); |
| 1837 // conn1 should be resurrected with original priority. | 1837 // conn1 should be resurrected with original priority. |
| 1838 port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), | 1838 port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), |
| 1839 cricket::PROTO_UDP, &request, kIceUfrag[1], false); | 1839 cricket::PROTO_UDP, &request, kIceUfrag[1], false); |
| 1840 conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1840 conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1841 ASSERT_TRUE(conn1 != nullptr); | 1841 ASSERT_TRUE(conn1 != nullptr); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); | 1938 cricket::P2PTransportChannel ch("receiving state change", 1, nullptr, &pa); |
| 1939 PrepareChannel(&ch); | 1939 PrepareChannel(&ch); |
| 1940 ch.SetIceRole(cricket::ICEROLE_CONTROLLED); | 1940 ch.SetIceRole(cricket::ICEROLE_CONTROLLED); |
| 1941 ch.Connect(); | 1941 ch.Connect(); |
| 1942 ch.MaybeStartGathering(); | 1942 ch.MaybeStartGathering(); |
| 1943 // A minimal STUN message with prflx priority. | 1943 // A minimal STUN message with prflx priority. |
| 1944 cricket::IceMessage request; | 1944 cricket::IceMessage request; |
| 1945 request.SetType(cricket::STUN_BINDING_REQUEST); | 1945 request.SetType(cricket::STUN_BINDING_REQUEST); |
| 1946 request.AddAttribute(new cricket::StunByteStringAttribute( | 1946 request.AddAttribute(new cricket::StunByteStringAttribute( |
| 1947 cricket::STUN_ATTR_USERNAME, kIceUfrag[1])); | 1947 cricket::STUN_ATTR_USERNAME, kIceUfrag[1])); |
| 1948 uint32 prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24; | 1948 uint32_t prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24; |
| 1949 request.AddAttribute(new cricket::StunUInt32Attribute( | 1949 request.AddAttribute(new cricket::StunUInt32Attribute( |
| 1950 cricket::STUN_ATTR_PRIORITY, prflx_priority)); | 1950 cricket::STUN_ATTR_PRIORITY, prflx_priority)); |
| 1951 cricket::Port* port = GetPort(&ch); | 1951 cricket::Port* port = GetPort(&ch); |
| 1952 port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), | 1952 port->SignalUnknownAddress(port, rtc::SocketAddress("1.1.1.1", 1), |
| 1953 cricket::PROTO_UDP, &request, kIceUfrag[1], false); | 1953 cricket::PROTO_UDP, &request, kIceUfrag[1], false); |
| 1954 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); | 1954 cricket::Connection* conn1 = WaitForConnectionTo(&ch, "1.1.1.1", 1); |
| 1955 ASSERT_TRUE(conn1 != nullptr); | 1955 ASSERT_TRUE(conn1 != nullptr); |
| 1956 EXPECT_EQ(conn1, ch.best_connection()); | 1956 EXPECT_EQ(conn1, ch.best_connection()); |
| 1957 conn1->ReceivedPingResponse(); | 1957 conn1->ReceivedPingResponse(); |
| 1958 EXPECT_EQ(conn1, ch.best_connection()); | 1958 EXPECT_EQ(conn1, ch.best_connection()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2025 // Switch because it is writable. | 2025 // Switch because it is writable. |
| 2026 conn2->OnReadPacket("DEF", 3, rtc::CreatePacketTime(0)); | 2026 conn2->OnReadPacket("DEF", 3, rtc::CreatePacketTime(0)); |
| 2027 EXPECT_EQ(conn2, ch.best_connection()); | 2027 EXPECT_EQ(conn2, ch.best_connection()); |
| 2028 | 2028 |
| 2029 // Now another STUN message with an unknown address and use_candidate will | 2029 // Now another STUN message with an unknown address and use_candidate will |
| 2030 // nominate the best connection. | 2030 // nominate the best connection. |
| 2031 cricket::IceMessage request; | 2031 cricket::IceMessage request; |
| 2032 request.SetType(cricket::STUN_BINDING_REQUEST); | 2032 request.SetType(cricket::STUN_BINDING_REQUEST); |
| 2033 request.AddAttribute(new cricket::StunByteStringAttribute( | 2033 request.AddAttribute(new cricket::StunByteStringAttribute( |
| 2034 cricket::STUN_ATTR_USERNAME, kIceUfrag[1])); | 2034 cricket::STUN_ATTR_USERNAME, kIceUfrag[1])); |
| 2035 uint32 prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24; | 2035 uint32_t prflx_priority = cricket::ICE_TYPE_PREFERENCE_PRFLX << 24; |
| 2036 request.AddAttribute(new cricket::StunUInt32Attribute( | 2036 request.AddAttribute(new cricket::StunUInt32Attribute( |
| 2037 cricket::STUN_ATTR_PRIORITY, prflx_priority)); | 2037 cricket::STUN_ATTR_PRIORITY, prflx_priority)); |
| 2038 request.AddAttribute( | 2038 request.AddAttribute( |
| 2039 new cricket::StunByteStringAttribute(cricket::STUN_ATTR_USE_CANDIDATE)); | 2039 new cricket::StunByteStringAttribute(cricket::STUN_ATTR_USE_CANDIDATE)); |
| 2040 cricket::Port* port = GetPort(&ch); | 2040 cricket::Port* port = GetPort(&ch); |
| 2041 port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3), | 2041 port->SignalUnknownAddress(port, rtc::SocketAddress("3.3.3.3", 3), |
| 2042 cricket::PROTO_UDP, &request, kIceUfrag[1], false); | 2042 cricket::PROTO_UDP, &request, kIceUfrag[1], false); |
| 2043 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); | 2043 cricket::Connection* conn3 = WaitForConnectionTo(&ch, "3.3.3.3", 3); |
| 2044 ASSERT_TRUE(conn3 != nullptr); | 2044 ASSERT_TRUE(conn3 != nullptr); |
| 2045 EXPECT_EQ(conn2, ch.best_connection()); // Not writable yet. | 2045 EXPECT_EQ(conn2, ch.best_connection()); // Not writable yet. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2152 conn2->ReceivedPingResponse(); | 2152 conn2->ReceivedPingResponse(); |
| 2153 EXPECT_EQ_WAIT(conn2, ch.best_connection(), 1000); | 2153 EXPECT_EQ_WAIT(conn2, ch.best_connection(), 1000); |
| 2154 EXPECT_EQ(cricket::TransportChannelState::STATE_CONNECTING, ch.GetState()); | 2154 EXPECT_EQ(cricket::TransportChannelState::STATE_CONNECTING, ch.GetState()); |
| 2155 | 2155 |
| 2156 // When |conn1| comes back again, |conn2| will be pruned again. | 2156 // When |conn1| comes back again, |conn2| will be pruned again. |
| 2157 conn1->ReceivedPingResponse(); | 2157 conn1->ReceivedPingResponse(); |
| 2158 EXPECT_EQ_WAIT(conn1, ch.best_connection(), 1000); | 2158 EXPECT_EQ_WAIT(conn1, ch.best_connection(), 1000); |
| 2159 EXPECT_TRUE_WAIT(!conn2->active(), 1000); | 2159 EXPECT_TRUE_WAIT(!conn2->active(), 1000); |
| 2160 EXPECT_EQ(cricket::TransportChannelState::STATE_COMPLETED, ch.GetState()); | 2160 EXPECT_EQ(cricket::TransportChannelState::STATE_COMPLETED, ch.GetState()); |
| 2161 } | 2161 } |
| OLD | NEW |