| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 static const SocketAddress kRelayTcpIntAddr("99.99.99.2", 5002); | 55 static const SocketAddress kRelayTcpIntAddr("99.99.99.2", 5002); |
| 56 static const SocketAddress kRelayTcpExtAddr("99.99.99.3", 5003); | 56 static const SocketAddress kRelayTcpExtAddr("99.99.99.3", 5003); |
| 57 static const SocketAddress kRelaySslTcpIntAddr("99.99.99.2", 5004); | 57 static const SocketAddress kRelaySslTcpIntAddr("99.99.99.2", 5004); |
| 58 static const SocketAddress kRelaySslTcpExtAddr("99.99.99.3", 5005); | 58 static const SocketAddress kRelaySslTcpExtAddr("99.99.99.3", 5005); |
| 59 static const SocketAddress kTurnUdpIntAddr("99.99.99.4", STUN_SERVER_PORT); | 59 static const SocketAddress kTurnUdpIntAddr("99.99.99.4", STUN_SERVER_PORT); |
| 60 static const SocketAddress kTurnUdpExtAddr("99.99.99.5", 0); | 60 static const SocketAddress kTurnUdpExtAddr("99.99.99.5", 0); |
| 61 static const RelayCredentials kRelayCredentials("test", "test"); | 61 static const RelayCredentials kRelayCredentials("test", "test"); |
| 62 | 62 |
| 63 // TODO: Update these when RFC5245 is completely supported. | 63 // TODO: Update these when RFC5245 is completely supported. |
| 64 // Magic value of 30 is from RFC3484, for IPv4 addresses. | 64 // Magic value of 30 is from RFC3484, for IPv4 addresses. |
| 65 static const uint32 kDefaultPrflxPriority = ICE_TYPE_PREFERENCE_PRFLX << 24 | | 65 static const uint32_t kDefaultPrflxPriority = |
| 66 30 << 8 | (256 - ICE_CANDIDATE_COMPONENT_DEFAULT); | 66 ICE_TYPE_PREFERENCE_PRFLX << 24 | 30 << 8 | |
| 67 (256 - ICE_CANDIDATE_COMPONENT_DEFAULT); |
| 67 | 68 |
| 68 static const int kTiebreaker1 = 11111; | 69 static const int kTiebreaker1 = 11111; |
| 69 static const int kTiebreaker2 = 22222; | 70 static const int kTiebreaker2 = 22222; |
| 70 | 71 |
| 71 static const char* data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; | 72 static const char* data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; |
| 72 | 73 |
| 73 static Candidate GetCandidate(Port* port) { | 74 static Candidate GetCandidate(Port* port) { |
| 74 assert(port->Candidates().size() >= 1); | 75 assert(port->Candidates().size() >= 1); |
| 75 return port->Candidates()[0]; | 76 return port->Candidates()[0]; |
| 76 } | 77 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 93 } | 94 } |
| 94 | 95 |
| 95 // Stub port class for testing STUN generation and processing. | 96 // Stub port class for testing STUN generation and processing. |
| 96 class TestPort : public Port { | 97 class TestPort : public Port { |
| 97 public: | 98 public: |
| 98 TestPort(rtc::Thread* thread, | 99 TestPort(rtc::Thread* thread, |
| 99 const std::string& type, | 100 const std::string& type, |
| 100 rtc::PacketSocketFactory* factory, | 101 rtc::PacketSocketFactory* factory, |
| 101 rtc::Network* network, | 102 rtc::Network* network, |
| 102 const rtc::IPAddress& ip, | 103 const rtc::IPAddress& ip, |
| 103 uint16 min_port, | 104 uint16_t min_port, |
| 104 uint16 max_port, | 105 uint16_t max_port, |
| 105 const std::string& username_fragment, | 106 const std::string& username_fragment, |
| 106 const std::string& password) | 107 const std::string& password) |
| 107 : Port(thread, type, factory, network, ip, min_port, max_port, | 108 : Port(thread, |
| 108 username_fragment, password) { | 109 type, |
| 109 } | 110 factory, |
| 111 network, |
| 112 ip, |
| 113 min_port, |
| 114 max_port, |
| 115 username_fragment, |
| 116 password) {} |
| 110 ~TestPort() {} | 117 ~TestPort() {} |
| 111 | 118 |
| 112 // Expose GetStunMessage so that we can test it. | 119 // Expose GetStunMessage so that we can test it. |
| 113 using cricket::Port::GetStunMessage; | 120 using cricket::Port::GetStunMessage; |
| 114 | 121 |
| 115 // The last StunMessage that was sent on this Port. | 122 // The last StunMessage that was sent on this Port. |
| 116 // TODO: Make these const; requires changes to SendXXXXResponse. | 123 // TODO: Make these const; requires changes to SendXXXXResponse. |
| 117 ByteBuffer* last_stun_buf() { return last_stun_buf_.get(); } | 124 ByteBuffer* last_stun_buf() { return last_stun_buf_.get(); } |
| 118 IceMessage* last_stun_msg() { return last_stun_msg_.get(); } | 125 IceMessage* last_stun_msg() { return last_stun_msg_.get(); } |
| 119 int last_stun_error_code() { | 126 int last_stun_error_code() { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 Candidate c = remote_candidate; | 249 Candidate c = remote_candidate; |
| 243 c.set_address(remote_address_); | 250 c.set_address(remote_address_); |
| 244 conn_ = port_->CreateConnection(c, Port::ORIGIN_MESSAGE); | 251 conn_ = port_->CreateConnection(c, Port::ORIGIN_MESSAGE); |
| 245 conn_->SignalDestroyed.connect(this, &TestChannel::OnDestroyed); | 252 conn_->SignalDestroyed.connect(this, &TestChannel::OnDestroyed); |
| 246 port_->SendBindingResponse(remote_request_.get(), remote_address_); | 253 port_->SendBindingResponse(remote_request_.get(), remote_address_); |
| 247 remote_request_.reset(); | 254 remote_request_.reset(); |
| 248 } | 255 } |
| 249 void Ping() { | 256 void Ping() { |
| 250 Ping(0); | 257 Ping(0); |
| 251 } | 258 } |
| 252 void Ping(uint32 now) { | 259 void Ping(uint32_t now) { conn_->Ping(now); } |
| 253 conn_->Ping(now); | |
| 254 } | |
| 255 void Stop() { | 260 void Stop() { |
| 256 if (conn_) { | 261 if (conn_) { |
| 257 conn_->Destroy(); | 262 conn_->Destroy(); |
| 258 } | 263 } |
| 259 } | 264 } |
| 260 | 265 |
| 261 void OnPortComplete(Port* port) { | 266 void OnPortComplete(Port* port) { |
| 262 complete_count_++; | 267 complete_count_++; |
| 263 } | 268 } |
| 264 void SetIceMode(IceMode ice_mode) { | 269 void SetIceMode(IceMode ice_mode) { |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 class FakePacketSocketFactory : public rtc::PacketSocketFactory { | 902 class FakePacketSocketFactory : public rtc::PacketSocketFactory { |
| 898 public: | 903 public: |
| 899 FakePacketSocketFactory() | 904 FakePacketSocketFactory() |
| 900 : next_udp_socket_(NULL), | 905 : next_udp_socket_(NULL), |
| 901 next_server_tcp_socket_(NULL), | 906 next_server_tcp_socket_(NULL), |
| 902 next_client_tcp_socket_(NULL) { | 907 next_client_tcp_socket_(NULL) { |
| 903 } | 908 } |
| 904 ~FakePacketSocketFactory() override { } | 909 ~FakePacketSocketFactory() override { } |
| 905 | 910 |
| 906 AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, | 911 AsyncPacketSocket* CreateUdpSocket(const SocketAddress& address, |
| 907 uint16 min_port, | 912 uint16_t min_port, |
| 908 uint16 max_port) override { | 913 uint16_t max_port) override { |
| 909 EXPECT_TRUE(next_udp_socket_ != NULL); | 914 EXPECT_TRUE(next_udp_socket_ != NULL); |
| 910 AsyncPacketSocket* result = next_udp_socket_; | 915 AsyncPacketSocket* result = next_udp_socket_; |
| 911 next_udp_socket_ = NULL; | 916 next_udp_socket_ = NULL; |
| 912 return result; | 917 return result; |
| 913 } | 918 } |
| 914 | 919 |
| 915 AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address, | 920 AsyncPacketSocket* CreateServerTcpSocket(const SocketAddress& local_address, |
| 916 uint16 min_port, | 921 uint16_t min_port, |
| 917 uint16 max_port, | 922 uint16_t max_port, |
| 918 int opts) override { | 923 int opts) override { |
| 919 EXPECT_TRUE(next_server_tcp_socket_ != NULL); | 924 EXPECT_TRUE(next_server_tcp_socket_ != NULL); |
| 920 AsyncPacketSocket* result = next_server_tcp_socket_; | 925 AsyncPacketSocket* result = next_server_tcp_socket_; |
| 921 next_server_tcp_socket_ = NULL; | 926 next_server_tcp_socket_ = NULL; |
| 922 return result; | 927 return result; |
| 923 } | 928 } |
| 924 | 929 |
| 925 // TODO: |proxy_info| and |user_agent| should be set | 930 // TODO: |proxy_info| and |user_agent| should be set |
| 926 // per-factory and not when socket is created. | 931 // per-factory and not when socket is created. |
| 927 AsyncPacketSocket* CreateClientTcpSocket(const SocketAddress& local_address, | 932 AsyncPacketSocket* CreateClientTcpSocket(const SocketAddress& local_address, |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1960 | 1965 |
| 1961 ASSERT_TRUE_WAIT(rport->last_stun_msg() != NULL, 1000); | 1966 ASSERT_TRUE_WAIT(rport->last_stun_msg() != NULL, 1000); |
| 1962 IceMessage* msg = rport->last_stun_msg(); | 1967 IceMessage* msg = rport->last_stun_msg(); |
| 1963 EXPECT_EQ(STUN_BINDING_REQUEST, msg->type()); | 1968 EXPECT_EQ(STUN_BINDING_REQUEST, msg->type()); |
| 1964 // Send rport binding request to lport. | 1969 // Send rport binding request to lport. |
| 1965 lconn->OnReadPacket(rport->last_stun_buf()->Data(), | 1970 lconn->OnReadPacket(rport->last_stun_buf()->Data(), |
| 1966 rport->last_stun_buf()->Length(), | 1971 rport->last_stun_buf()->Length(), |
| 1967 rtc::PacketTime()); | 1972 rtc::PacketTime()); |
| 1968 ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000); | 1973 ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, 1000); |
| 1969 EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type()); | 1974 EXPECT_EQ(STUN_BINDING_RESPONSE, lport->last_stun_msg()->type()); |
| 1970 uint32 last_ping_received1 = lconn->last_ping_received(); | 1975 uint32_t last_ping_received1 = lconn->last_ping_received(); |
| 1971 | 1976 |
| 1972 // Adding a delay of 100ms. | 1977 // Adding a delay of 100ms. |
| 1973 rtc::Thread::Current()->ProcessMessages(100); | 1978 rtc::Thread::Current()->ProcessMessages(100); |
| 1974 // Pinging lconn using stun indication message. | 1979 // Pinging lconn using stun indication message. |
| 1975 lconn->OnReadPacket(buf->Data(), buf->Length(), rtc::PacketTime()); | 1980 lconn->OnReadPacket(buf->Data(), buf->Length(), rtc::PacketTime()); |
| 1976 uint32 last_ping_received2 = lconn->last_ping_received(); | 1981 uint32_t last_ping_received2 = lconn->last_ping_received(); |
| 1977 EXPECT_GT(last_ping_received2, last_ping_received1); | 1982 EXPECT_GT(last_ping_received2, last_ping_received1); |
| 1978 } | 1983 } |
| 1979 | 1984 |
| 1980 TEST_F(PortTest, TestComputeCandidatePriority) { | 1985 TEST_F(PortTest, TestComputeCandidatePriority) { |
| 1981 rtc::scoped_ptr<TestPort> port( | 1986 rtc::scoped_ptr<TestPort> port( |
| 1982 CreateTestPort(kLocalAddr1, "name", "pass")); | 1987 CreateTestPort(kLocalAddr1, "name", "pass")); |
| 1983 port->set_type_preference(90); | 1988 port->set_type_preference(90); |
| 1984 port->set_component(177); | 1989 port->set_component(177); |
| 1985 port->AddCandidateAddress(SocketAddress("192.168.1.4", 1234)); | 1990 port->AddCandidateAddress(SocketAddress("192.168.1.4", 1234)); |
| 1986 port->AddCandidateAddress(SocketAddress("2001:db8::1234", 1234)); | 1991 port->AddCandidateAddress(SocketAddress("2001:db8::1234", 1234)); |
| 1987 port->AddCandidateAddress(SocketAddress("fc12:3456::1234", 1234)); | 1992 port->AddCandidateAddress(SocketAddress("fc12:3456::1234", 1234)); |
| 1988 port->AddCandidateAddress(SocketAddress("::ffff:192.168.1.4", 1234)); | 1993 port->AddCandidateAddress(SocketAddress("::ffff:192.168.1.4", 1234)); |
| 1989 port->AddCandidateAddress(SocketAddress("::192.168.1.4", 1234)); | 1994 port->AddCandidateAddress(SocketAddress("::192.168.1.4", 1234)); |
| 1990 port->AddCandidateAddress(SocketAddress("2002::1234:5678", 1234)); | 1995 port->AddCandidateAddress(SocketAddress("2002::1234:5678", 1234)); |
| 1991 port->AddCandidateAddress(SocketAddress("2001::1234:5678", 1234)); | 1996 port->AddCandidateAddress(SocketAddress("2001::1234:5678", 1234)); |
| 1992 port->AddCandidateAddress(SocketAddress("fecf::1234:5678", 1234)); | 1997 port->AddCandidateAddress(SocketAddress("fecf::1234:5678", 1234)); |
| 1993 port->AddCandidateAddress(SocketAddress("3ffe::1234:5678", 1234)); | 1998 port->AddCandidateAddress(SocketAddress("3ffe::1234:5678", 1234)); |
| 1994 // These should all be: | 1999 // These should all be: |
| 1995 // (90 << 24) | ([rfc3484 pref value] << 8) | (256 - 177) | 2000 // (90 << 24) | ([rfc3484 pref value] << 8) | (256 - 177) |
| 1996 uint32 expected_priority_v4 = 1509957199U; | 2001 uint32_t expected_priority_v4 = 1509957199U; |
| 1997 uint32 expected_priority_v6 = 1509959759U; | 2002 uint32_t expected_priority_v6 = 1509959759U; |
| 1998 uint32 expected_priority_ula = 1509962319U; | 2003 uint32_t expected_priority_ula = 1509962319U; |
| 1999 uint32 expected_priority_v4mapped = expected_priority_v4; | 2004 uint32_t expected_priority_v4mapped = expected_priority_v4; |
| 2000 uint32 expected_priority_v4compat = 1509949775U; | 2005 uint32_t expected_priority_v4compat = 1509949775U; |
| 2001 uint32 expected_priority_6to4 = 1509954639U; | 2006 uint32_t expected_priority_6to4 = 1509954639U; |
| 2002 uint32 expected_priority_teredo = 1509952079U; | 2007 uint32_t expected_priority_teredo = 1509952079U; |
| 2003 uint32 expected_priority_sitelocal = 1509949775U; | 2008 uint32_t expected_priority_sitelocal = 1509949775U; |
| 2004 uint32 expected_priority_6bone = 1509949775U; | 2009 uint32_t expected_priority_6bone = 1509949775U; |
| 2005 ASSERT_EQ(expected_priority_v4, port->Candidates()[0].priority()); | 2010 ASSERT_EQ(expected_priority_v4, port->Candidates()[0].priority()); |
| 2006 ASSERT_EQ(expected_priority_v6, port->Candidates()[1].priority()); | 2011 ASSERT_EQ(expected_priority_v6, port->Candidates()[1].priority()); |
| 2007 ASSERT_EQ(expected_priority_ula, port->Candidates()[2].priority()); | 2012 ASSERT_EQ(expected_priority_ula, port->Candidates()[2].priority()); |
| 2008 ASSERT_EQ(expected_priority_v4mapped, port->Candidates()[3].priority()); | 2013 ASSERT_EQ(expected_priority_v4mapped, port->Candidates()[3].priority()); |
| 2009 ASSERT_EQ(expected_priority_v4compat, port->Candidates()[4].priority()); | 2014 ASSERT_EQ(expected_priority_v4compat, port->Candidates()[4].priority()); |
| 2010 ASSERT_EQ(expected_priority_6to4, port->Candidates()[5].priority()); | 2015 ASSERT_EQ(expected_priority_6to4, port->Candidates()[5].priority()); |
| 2011 ASSERT_EQ(expected_priority_teredo, port->Candidates()[6].priority()); | 2016 ASSERT_EQ(expected_priority_teredo, port->Candidates()[6].priority()); |
| 2012 ASSERT_EQ(expected_priority_sitelocal, port->Candidates()[7].priority()); | 2017 ASSERT_EQ(expected_priority_sitelocal, port->Candidates()[7].priority()); |
| 2013 ASSERT_EQ(expected_priority_6bone, port->Candidates()[8].priority()); | 2018 ASSERT_EQ(expected_priority_6bone, port->Candidates()[8].priority()); |
| 2014 } | 2019 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2226 // Accept the connection to return the binding response, transition to | 2231 // Accept the connection to return the binding response, transition to |
| 2227 // writable, and allow data to be sent. | 2232 // writable, and allow data to be sent. |
| 2228 ch2.AcceptConnection(GetCandidate(port1)); | 2233 ch2.AcceptConnection(GetCandidate(port1)); |
| 2229 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, ch1.conn()->write_state(), | 2234 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, ch1.conn()->write_state(), |
| 2230 kTimeout); | 2235 kTimeout); |
| 2231 EXPECT_EQ(data_size, ch1.conn()->Send(data, data_size, options)); | 2236 EXPECT_EQ(data_size, ch1.conn()->Send(data, data_size, options)); |
| 2232 | 2237 |
| 2233 // Ask the connection to update state as if enough time has passed to lose | 2238 // Ask the connection to update state as if enough time has passed to lose |
| 2234 // full writability and 5 pings went unresponded to. We'll accomplish the | 2239 // full writability and 5 pings went unresponded to. We'll accomplish the |
| 2235 // latter by sending pings but not pumping messages. | 2240 // latter by sending pings but not pumping messages. |
| 2236 for (uint32 i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) { | 2241 for (uint32_t i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) { |
| 2237 ch1.Ping(i); | 2242 ch1.Ping(i); |
| 2238 } | 2243 } |
| 2239 uint32 unreliable_timeout_delay = CONNECTION_WRITE_CONNECT_TIMEOUT + 500u; | 2244 uint32_t unreliable_timeout_delay = CONNECTION_WRITE_CONNECT_TIMEOUT + 500u; |
| 2240 ch1.conn()->UpdateState(unreliable_timeout_delay); | 2245 ch1.conn()->UpdateState(unreliable_timeout_delay); |
| 2241 EXPECT_EQ(Connection::STATE_WRITE_UNRELIABLE, ch1.conn()->write_state()); | 2246 EXPECT_EQ(Connection::STATE_WRITE_UNRELIABLE, ch1.conn()->write_state()); |
| 2242 | 2247 |
| 2243 // Data should be able to be sent in this state. | 2248 // Data should be able to be sent in this state. |
| 2244 EXPECT_EQ(data_size, ch1.conn()->Send(data, data_size, options)); | 2249 EXPECT_EQ(data_size, ch1.conn()->Send(data, data_size, options)); |
| 2245 | 2250 |
| 2246 // And now allow the other side to process the pings and send binding | 2251 // And now allow the other side to process the pings and send binding |
| 2247 // responses. | 2252 // responses. |
| 2248 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, ch1.conn()->write_state(), | 2253 EXPECT_EQ_WAIT(Connection::STATE_WRITABLE, ch1.conn()->write_state(), |
| 2249 kTimeout); | 2254 kTimeout); |
| 2250 | 2255 |
| 2251 // Wait long enough for a full timeout (past however long we've already | 2256 // Wait long enough for a full timeout (past however long we've already |
| 2252 // waited). | 2257 // waited). |
| 2253 for (uint32 i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) { | 2258 for (uint32_t i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) { |
| 2254 ch1.Ping(unreliable_timeout_delay + i); | 2259 ch1.Ping(unreliable_timeout_delay + i); |
| 2255 } | 2260 } |
| 2256 ch1.conn()->UpdateState(unreliable_timeout_delay + CONNECTION_WRITE_TIMEOUT + | 2261 ch1.conn()->UpdateState(unreliable_timeout_delay + CONNECTION_WRITE_TIMEOUT + |
| 2257 500u); | 2262 500u); |
| 2258 EXPECT_EQ(Connection::STATE_WRITE_TIMEOUT, ch1.conn()->write_state()); | 2263 EXPECT_EQ(Connection::STATE_WRITE_TIMEOUT, ch1.conn()->write_state()); |
| 2259 | 2264 |
| 2260 // Now that the connection has completely timed out, data send should fail. | 2265 // Now that the connection has completely timed out, data send should fail. |
| 2261 EXPECT_EQ(SOCKET_ERROR, ch1.conn()->Send(data, data_size, options)); | 2266 EXPECT_EQ(SOCKET_ERROR, ch1.conn()->Send(data, data_size, options)); |
| 2262 | 2267 |
| 2263 ch1.Stop(); | 2268 ch1.Stop(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2276 | 2281 |
| 2277 // Acquire addresses. | 2282 // Acquire addresses. |
| 2278 ch1.Start(); | 2283 ch1.Start(); |
| 2279 ch2.Start(); | 2284 ch2.Start(); |
| 2280 | 2285 |
| 2281 ch1.CreateConnection(GetCandidate(port2)); | 2286 ch1.CreateConnection(GetCandidate(port2)); |
| 2282 ASSERT_TRUE(ch1.conn() != NULL); | 2287 ASSERT_TRUE(ch1.conn() != NULL); |
| 2283 EXPECT_EQ(Connection::STATE_WRITE_INIT, ch1.conn()->write_state()); | 2288 EXPECT_EQ(Connection::STATE_WRITE_INIT, ch1.conn()->write_state()); |
| 2284 | 2289 |
| 2285 // Attempt to go directly to write timeout. | 2290 // Attempt to go directly to write timeout. |
| 2286 for (uint32 i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) { | 2291 for (uint32_t i = 1; i <= CONNECTION_WRITE_CONNECT_FAILURES; ++i) { |
| 2287 ch1.Ping(i); | 2292 ch1.Ping(i); |
| 2288 } | 2293 } |
| 2289 ch1.conn()->UpdateState(CONNECTION_WRITE_TIMEOUT + 500u); | 2294 ch1.conn()->UpdateState(CONNECTION_WRITE_TIMEOUT + 500u); |
| 2290 EXPECT_EQ(Connection::STATE_WRITE_TIMEOUT, ch1.conn()->write_state()); | 2295 EXPECT_EQ(Connection::STATE_WRITE_TIMEOUT, ch1.conn()->write_state()); |
| 2291 } | 2296 } |
| 2292 | 2297 |
| 2293 // This test verifies the connection setup between ICEMODE_FULL | 2298 // This test verifies the connection setup between ICEMODE_FULL |
| 2294 // and ICEMODE_LITE. | 2299 // and ICEMODE_LITE. |
| 2295 // In this test |ch1| behaves like FULL mode client and we have created | 2300 // In this test |ch1| behaves like FULL mode client and we have created |
| 2296 // port which responds to the ping message just like LITE client. | 2301 // port which responds to the ping message just like LITE client. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 // Set up channels and ensure both ports will be deleted. | 2408 // Set up channels and ensure both ports will be deleted. |
| 2404 TestChannel ch1(port1); | 2409 TestChannel ch1(port1); |
| 2405 TestChannel ch2(port2); | 2410 TestChannel ch2(port2); |
| 2406 | 2411 |
| 2407 // Simulate a connection that succeeds, and then is destroyed. | 2412 // Simulate a connection that succeeds, and then is destroyed. |
| 2408 StartConnectAndStopChannels(&ch1, &ch2); | 2413 StartConnectAndStopChannels(&ch1, &ch2); |
| 2409 | 2414 |
| 2410 // The controlled port should be destroyed after 10 milliseconds. | 2415 // The controlled port should be destroyed after 10 milliseconds. |
| 2411 EXPECT_TRUE_WAIT(destroyed(), kTimeout); | 2416 EXPECT_TRUE_WAIT(destroyed(), kTimeout); |
| 2412 } | 2417 } |
| OLD | NEW |