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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 bool nominated() const { return nominated_; } | 334 bool nominated() const { return nominated_; } |
335 | 335 |
336 void set_connection_ready_to_send(bool ready) { | 336 void set_connection_ready_to_send(bool ready) { |
337 connection_ready_to_send_ = ready; | 337 connection_ready_to_send_ = ready; |
338 } | 338 } |
339 bool connection_ready_to_send() const { | 339 bool connection_ready_to_send() const { |
340 return connection_ready_to_send_; | 340 return connection_ready_to_send_; |
341 } | 341 } |
342 | 342 |
343 private: | 343 private: |
344 // ReadyToSend will only issue after a Connection recovers from EWOULDBLOCK. | 344 // ReadyToSend will only issue after a Connection recovers from ENOTCONN |
345 void OnConnectionReadyToSend(Connection* conn) { | 345 void OnConnectionReadyToSend(Connection* conn) { |
346 ASSERT_EQ(conn, conn_); | 346 ASSERT_EQ(conn, conn_); |
347 connection_ready_to_send_ = true; | 347 connection_ready_to_send_ = true; |
348 } | 348 } |
349 | 349 |
350 IceMode ice_mode_; | 350 IceMode ice_mode_; |
351 std::unique_ptr<Port> port_; | 351 std::unique_ptr<Port> port_; |
352 | 352 |
353 int complete_count_; | 353 int complete_count_; |
354 Connection* conn_; | 354 Connection* conn_; |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 } | 689 } |
690 | 690 |
691 // Wait for channel's outgoing TCPConnection connected. | 691 // Wait for channel's outgoing TCPConnection connected. |
692 EXPECT_TRUE_WAIT(ch1.conn()->connected(), kTimeout); | 692 EXPECT_TRUE_WAIT(ch1.conn()->connected(), kTimeout); |
693 | 693 |
694 // Verify that we could still connect channels. | 694 // Verify that we could still connect channels. |
695 ConnectStartedChannels(&ch1, &ch2); | 695 ConnectStartedChannels(&ch1, &ch2); |
696 EXPECT_TRUE_WAIT(ch1.connection_ready_to_send(), | 696 EXPECT_TRUE_WAIT(ch1.connection_ready_to_send(), |
697 kTcpReconnectTimeout); | 697 kTcpReconnectTimeout); |
698 // Channel2 is the passive one so a new connection is created during | 698 // Channel2 is the passive one so a new connection is created during |
699 // reconnect. This new connection should never have issued EWOULDBLOCK | 699 // reconnect. This new connection should never have issued ENOTCONN |
700 // hence the connection_ready_to_send() should be false. | 700 // hence the connection_ready_to_send() should be false. |
701 EXPECT_FALSE(ch2.connection_ready_to_send()); | 701 EXPECT_FALSE(ch2.connection_ready_to_send()); |
702 } else { | 702 } else { |
703 EXPECT_EQ(ch1.conn()->write_state(), Connection::STATE_WRITABLE); | 703 EXPECT_EQ(ch1.conn()->write_state(), Connection::STATE_WRITABLE); |
704 // Since the reconnection never happens, the connections should have been | 704 // Since the reconnection never happens, the connections should have been |
705 // destroyed after the timeout. | 705 // destroyed after the timeout. |
706 EXPECT_TRUE_WAIT(!ch1.conn(), kTcpReconnectTimeout + kTimeout); | 706 EXPECT_TRUE_WAIT(!ch1.conn(), kTcpReconnectTimeout + kTimeout); |
707 EXPECT_TRUE(!ch2.conn()); | 707 EXPECT_TRUE(!ch2.conn()); |
708 } | 708 } |
709 | 709 |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2714 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); | 2714 port->CreateConnection(candidate, Port::ORIGIN_MESSAGE); |
2715 EXPECT_NE(conn1, conn2); | 2715 EXPECT_NE(conn1, conn2); |
2716 conn_in_use = port->GetConnection(address); | 2716 conn_in_use = port->GetConnection(address); |
2717 EXPECT_EQ(conn2, conn_in_use); | 2717 EXPECT_EQ(conn2, conn_in_use); |
2718 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); | 2718 EXPECT_EQ(2u, conn_in_use->remote_candidate().generation()); |
2719 | 2719 |
2720 // Make sure the new connection was not deleted. | 2720 // Make sure the new connection was not deleted. |
2721 rtc::Thread::Current()->ProcessMessages(300); | 2721 rtc::Thread::Current()->ProcessMessages(300); |
2722 EXPECT_TRUE(port->GetConnection(address) != nullptr); | 2722 EXPECT_TRUE(port->GetConnection(address) != nullptr); |
2723 } | 2723 } |
OLD | NEW |