OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 442 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
443 ProcessUdpPacket(_, _, _)) | 443 ProcessUdpPacket(_, _, _)) |
444 .WillOnce( | 444 .WillOnce( |
445 Invoke(reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 445 Invoke(reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
446 &MockQuicConnection::ReallyProcessUdpPacket)); | 446 &MockQuicConnection::ReallyProcessUdpPacket)); |
447 dispatcher_->ProcessPacket(QuicSocketAddress(), client_address, *received); | 447 dispatcher_->ProcessPacket(QuicSocketAddress(), client_address, *received); |
448 EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); | 448 EXPECT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); |
449 | 449 |
450 // Dispatcher forwards subsequent packets for this connection_id to the time | 450 // Dispatcher forwards subsequent packets for this connection_id to the time |
451 // wait list manager. | 451 // wait list manager. |
452 EXPECT_CALL(*time_wait_list_manager_, | 452 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) |
453 ProcessPacket(_, _, connection_id, _, _)) | |
454 .Times(1); | 453 .Times(1); |
455 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 454 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
456 .Times(0); | 455 .Times(0); |
457 ProcessPacket(client_address, connection_id, true, "data"); | 456 ProcessPacket(client_address, connection_id, true, "data"); |
458 } | 457 } |
459 | 458 |
460 TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) { | 459 TEST_F(QuicDispatcherTest, NoVersionPacketToTimeWaitListManager) { |
461 CreateTimeWaitListManager(); | 460 CreateTimeWaitListManager(); |
462 | 461 |
463 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 462 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
464 QuicConnectionId connection_id = 1; | 463 QuicConnectionId connection_id = 1; |
465 // Dispatcher forwards all packets for this connection_id to the time wait | 464 // Dispatcher forwards all packets for this connection_id to the time wait |
466 // list manager. | 465 // list manager. |
467 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); | 466 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); |
468 EXPECT_CALL(*time_wait_list_manager_, | 467 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) |
469 ProcessPacket(_, _, connection_id, _, _)) | |
470 .Times(1); | 468 .Times(1); |
471 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 469 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
472 .Times(1); | 470 .Times(1); |
473 ProcessPacket(client_address, connection_id, false, SerializeCHLO()); | 471 ProcessPacket(client_address, connection_id, false, SerializeCHLO()); |
474 } | 472 } |
475 | 473 |
476 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { | 474 TEST_F(QuicDispatcherTest, ProcessPacketWithZeroPort) { |
477 CreateTimeWaitListManager(); | 475 CreateTimeWaitListManager(); |
478 | 476 |
479 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 0); | 477 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 0); |
480 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); | 478 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); |
481 | 479 |
482 // dispatcher_ should drop this packet. | 480 // dispatcher_ should drop this packet. |
483 EXPECT_CALL(*dispatcher_, CreateQuicSession(1, client_address)).Times(0); | 481 EXPECT_CALL(*dispatcher_, CreateQuicSession(1, client_address)).Times(0); |
484 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _, _)).Times(0); | 482 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, _, _)).Times(0); |
485 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 483 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
486 .Times(0); | 484 .Times(0); |
487 ProcessPacket(client_address, 1, true, SerializeCHLO()); | 485 ProcessPacket(client_address, 1, true, SerializeCHLO()); |
488 } | 486 } |
489 | 487 |
490 TEST_F(QuicDispatcherTest, OKSeqNoPacketProcessed) { | 488 TEST_F(QuicDispatcherTest, OKSeqNoPacketProcessed) { |
491 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 489 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
492 QuicConnectionId connection_id = 1; | 490 QuicConnectionId connection_id = 1; |
493 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); | 491 server_address_ = QuicSocketAddress(QuicIpAddress::Any4(), 5); |
494 | 492 |
(...skipping 16 matching lines...) Expand all Loading... |
511 } | 509 } |
512 | 510 |
513 TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) { | 511 TEST_F(QuicDispatcherTest, TooBigSeqNoPacketToTimeWaitListManager) { |
514 CreateTimeWaitListManager(); | 512 CreateTimeWaitListManager(); |
515 | 513 |
516 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 514 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
517 QuicConnectionId connection_id = 1; | 515 QuicConnectionId connection_id = 1; |
518 // Dispatcher forwards this packet for this connection_id to the time wait | 516 // Dispatcher forwards this packet for this connection_id to the time wait |
519 // list manager. | 517 // list manager. |
520 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); | 518 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); |
521 EXPECT_CALL(*time_wait_list_manager_, | 519 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) |
522 ProcessPacket(_, _, connection_id, _, _)) | |
523 .Times(1); | 520 .Times(1); |
524 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 521 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
525 .Times(1); | 522 .Times(1); |
526 // A packet whose packet number is one to large to be allowed to start a | 523 // A packet whose packet number is one to large to be allowed to start a |
527 // connection. | 524 // connection. |
528 ProcessPacket(client_address, connection_id, true, SerializeCHLO(), | 525 ProcessPacket(client_address, connection_id, true, SerializeCHLO(), |
529 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, | 526 PACKET_8BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER, |
530 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); | 527 QuicDispatcher::kMaxReasonableInitialPacketNumber + 1); |
531 } | 528 } |
532 | 529 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, "stateless reject", | 742 QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, "stateless reject", |
746 ConnectionCloseBehavior::SILENT_CLOSE); | 743 ConnectionCloseBehavior::SILENT_CLOSE); |
747 } | 744 } |
748 | 745 |
749 // Send a second packet and check the results. If this is a stateless reject, | 746 // Send a second packet and check the results. If this is a stateless reject, |
750 // the existing connection_id will go on the time-wait list. | 747 // the existing connection_id will go on the time-wait list. |
751 EXPECT_EQ(ExpectStatelessReject(), | 748 EXPECT_EQ(ExpectStatelessReject(), |
752 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); | 749 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); |
753 if (ExpectStatelessReject()) { | 750 if (ExpectStatelessReject()) { |
754 // The second packet will be processed on the time-wait list. | 751 // The second packet will be processed on the time-wait list. |
755 EXPECT_CALL(*time_wait_list_manager_, | 752 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) |
756 ProcessPacket(_, _, connection_id, _, _)) | |
757 .Times(1); | 753 .Times(1); |
758 } else { | 754 } else { |
759 // The second packet will trigger a packet-validation | 755 // The second packet will trigger a packet-validation |
760 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), | 756 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), |
761 ProcessUdpPacket(_, _, _)) | 757 ProcessUdpPacket(_, _, _)) |
762 .Times(1) | 758 .Times(1) |
763 .WillOnce(testing::WithArgs<2>( | 759 .WillOnce(testing::WithArgs<2>( |
764 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, | 760 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, |
765 base::Unretained(this), connection_id)))); | 761 base::Unretained(this), connection_id)))); |
766 } | 762 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 853 |
858 // Packets with truncated connection IDs should be dropped. | 854 // Packets with truncated connection IDs should be dropped. |
859 TEST_F(QuicDispatcherTestStrayPacketConnectionId, | 855 TEST_F(QuicDispatcherTestStrayPacketConnectionId, |
860 StrayPacketTruncatedConnectionId) { | 856 StrayPacketTruncatedConnectionId) { |
861 CreateTimeWaitListManager(); | 857 CreateTimeWaitListManager(); |
862 | 858 |
863 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); | 859 QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); |
864 QuicConnectionId connection_id = 1; | 860 QuicConnectionId connection_id = 1; |
865 // Dispatcher drops this packet. | 861 // Dispatcher drops this packet. |
866 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); | 862 EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _)).Times(0); |
867 EXPECT_CALL(*time_wait_list_manager_, | 863 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, connection_id, _)) |
868 ProcessPacket(_, _, connection_id, _, _)) | |
869 .Times(0); | 864 .Times(0); |
870 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) | 865 EXPECT_CALL(*time_wait_list_manager_, AddConnectionIdToTimeWait(_, _, _, _)) |
871 .Times(0); | 866 .Times(0); |
872 ProcessPacket(client_address, connection_id, true, "data", | 867 ProcessPacket(client_address, connection_id, true, "data", |
873 PACKET_0BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); | 868 PACKET_0BYTE_CONNECTION_ID, PACKET_6BYTE_PACKET_NUMBER); |
874 } | 869 } |
875 | 870 |
876 class BlockingWriter : public QuicPacketWriterWrapper { | 871 class BlockingWriter : public QuicPacketWriterWrapper { |
877 public: | 872 public: |
878 BlockingWriter() : write_blocked_(false) {} | 873 BlockingWriter() : write_blocked_(false) {} |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 | 1338 |
1344 mock_helper_.AdvanceTime( | 1339 mock_helper_.AdvanceTime( |
1345 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs)); | 1340 QuicTime::Delta::FromSeconds(kInitialIdleTimeoutSecs)); |
1346 QuicAlarm* alarm = QuicBufferedPacketStorePeer::expiration_alarm(store); | 1341 QuicAlarm* alarm = QuicBufferedPacketStorePeer::expiration_alarm(store); |
1347 // Cancel alarm as if it had been fired. | 1342 // Cancel alarm as if it had been fired. |
1348 alarm->Cancel(); | 1343 alarm->Cancel(); |
1349 store->OnExpirationTimeout(); | 1344 store->OnExpirationTimeout(); |
1350 // New arrived CHLO will be dropped because this connection is in time wait | 1345 // New arrived CHLO will be dropped because this connection is in time wait |
1351 // list. | 1346 // list. |
1352 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); | 1347 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); |
1353 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id, _, _)); | 1348 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id, _)); |
1354 ProcessPacket(client_address, conn_id, true, SerializeFullCHLO()); | 1349 ProcessPacket(client_address, conn_id, true, SerializeFullCHLO()); |
1355 } | 1350 } |
1356 | 1351 |
1357 TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) { | 1352 TEST_P(BufferedPacketStoreTest, ProcessCHLOsUptoLimitAndBufferTheRest) { |
1358 FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; | 1353 FLAGS_quic_reloadable_flag_quic_limit_num_new_sessions_per_epoll_loop = true; |
1359 // Process more than (|kMaxNumSessionsToCreate| + | 1354 // Process more than (|kMaxNumSessionsToCreate| + |
1360 // |kDefaultMaxConnectionsInStore|) CHLOs, | 1355 // |kDefaultMaxConnectionsInStore|) CHLOs, |
1361 // the first |kMaxNumSessionsToCreate| should create connections immediately, | 1356 // the first |kMaxNumSessionsToCreate| should create connections immediately, |
1362 // the next |kDefaultMaxConnectionsInStore| should be buffered, | 1357 // the next |kDefaultMaxConnectionsInStore| should be buffered, |
1363 // the rest should be dropped. | 1358 // the rest should be dropped. |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 | 1696 |
1702 QuicConnectionId conn_id = 1; | 1697 QuicConnectionId conn_id = 1; |
1703 | 1698 |
1704 testing::MockFunction<void(int check_point)> check; | 1699 testing::MockFunction<void(int check_point)> check; |
1705 { | 1700 { |
1706 InSequence s; | 1701 InSequence s; |
1707 EXPECT_CALL(check, Call(1)); | 1702 EXPECT_CALL(check, Call(1)); |
1708 EXPECT_CALL(*time_wait_list_manager_, | 1703 EXPECT_CALL(*time_wait_list_manager_, |
1709 AddConnectionIdToTimeWait(conn_id, _, true, _)); | 1704 AddConnectionIdToTimeWait(conn_id, _, true, _)); |
1710 EXPECT_CALL(*time_wait_list_manager_, | 1705 EXPECT_CALL(*time_wait_list_manager_, |
1711 ProcessPacket(_, client_addr_, conn_id, _, _)); | 1706 ProcessPacket(_, client_addr_, conn_id, _)); |
1712 | 1707 |
1713 EXPECT_CALL(check, Call(2)); | 1708 EXPECT_CALL(check, Call(2)); |
1714 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) | 1709 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) |
1715 .Times(0); | 1710 .Times(0); |
1716 EXPECT_CALL(*time_wait_list_manager_, | 1711 EXPECT_CALL(*time_wait_list_manager_, |
1717 ProcessPacket(_, client_addr_, conn_id, _, _)); | 1712 ProcessPacket(_, client_addr_, conn_id, _)); |
1718 } | 1713 } |
1719 | 1714 |
1720 // Send a CHLO that the StatelessRejector will reject. | 1715 // Send a CHLO that the StatelessRejector will reject. |
1721 ProcessPacket(client_addr_, conn_id, true, SerializeCHLO()); | 1716 ProcessPacket(client_addr_, conn_id, true, SerializeCHLO()); |
1722 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1717 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1723 | 1718 |
1724 // Complete the ProofSource::GetProof call and verify that the connection and | 1719 // Complete the ProofSource::GetProof call and verify that the connection and |
1725 // packet are processed by the time wait list manager. | 1720 // packet are processed by the time wait list manager. |
1726 check.Call(1); | 1721 check.Call(1); |
1727 GetFakeProofSource()->InvokePendingCallback(0); | 1722 GetFakeProofSource()->InvokePendingCallback(0); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 testing::MockFunction<void(int check_point)> check; | 1818 testing::MockFunction<void(int check_point)> check; |
1824 { | 1819 { |
1825 InSequence s; | 1820 InSequence s; |
1826 | 1821 |
1827 EXPECT_CALL(check, Call(1)); | 1822 EXPECT_CALL(check, Call(1)); |
1828 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_2, client_addr_)) | 1823 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_2, client_addr_)) |
1829 .Times(0); | 1824 .Times(0); |
1830 EXPECT_CALL(*time_wait_list_manager_, | 1825 EXPECT_CALL(*time_wait_list_manager_, |
1831 AddConnectionIdToTimeWait(conn_id_2, _, true, _)); | 1826 AddConnectionIdToTimeWait(conn_id_2, _, true, _)); |
1832 EXPECT_CALL(*time_wait_list_manager_, | 1827 EXPECT_CALL(*time_wait_list_manager_, |
1833 ProcessPacket(_, client_addr_, conn_id_2, _, _)); | 1828 ProcessPacket(_, client_addr_, conn_id_2, _)); |
1834 | 1829 |
1835 EXPECT_CALL(check, Call(2)); | 1830 EXPECT_CALL(check, Call(2)); |
1836 EXPECT_CALL(*time_wait_list_manager_, | 1831 EXPECT_CALL(*time_wait_list_manager_, |
1837 ProcessPacket(_, client_addr_, conn_id_2, _, _)); | 1832 ProcessPacket(_, client_addr_, conn_id_2, _)); |
1838 | 1833 |
1839 EXPECT_CALL(check, Call(3)); | 1834 EXPECT_CALL(check, Call(3)); |
1840 EXPECT_CALL(*dispatcher_, | 1835 EXPECT_CALL(*dispatcher_, |
1841 ShouldCreateOrBufferPacketForConnection(conn_id_1)); | 1836 ShouldCreateOrBufferPacketForConnection(conn_id_1)); |
1842 | 1837 |
1843 EXPECT_CALL(check, Call(4)); | 1838 EXPECT_CALL(check, Call(4)); |
1844 EXPECT_CALL(*time_wait_list_manager_, | 1839 EXPECT_CALL(*time_wait_list_manager_, |
1845 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); | 1840 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); |
1846 EXPECT_CALL(*time_wait_list_manager_, | 1841 EXPECT_CALL(*time_wait_list_manager_, |
1847 ProcessPacket(_, client_addr_, conn_id_1, _, _)); | 1842 ProcessPacket(_, client_addr_, conn_id_1, _)); |
1848 } | 1843 } |
1849 | 1844 |
1850 // Send a CHLO that the StatelessRejector will reject. | 1845 // Send a CHLO that the StatelessRejector will reject. |
1851 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); | 1846 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); |
1852 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1847 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1853 | 1848 |
1854 // Send another CHLO that the StatelessRejector will reject. | 1849 // Send another CHLO that the StatelessRejector will reject. |
1855 ProcessPacket(client_addr_, conn_id_2, true, SerializeCHLO()); | 1850 ProcessPacket(client_addr_, conn_id_2, true, SerializeCHLO()); |
1856 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 2); | 1851 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 2); |
1857 | 1852 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 EXPECT_CALL(check, Call(1)); | 1891 EXPECT_CALL(check, Call(1)); |
1897 EXPECT_CALL(*dispatcher_, | 1892 EXPECT_CALL(*dispatcher_, |
1898 ShouldCreateOrBufferPacketForConnection(conn_id_1)); | 1893 ShouldCreateOrBufferPacketForConnection(conn_id_1)); |
1899 | 1894 |
1900 EXPECT_CALL(check, Call(2)); | 1895 EXPECT_CALL(check, Call(2)); |
1901 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_1, client_addr_)) | 1896 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id_1, client_addr_)) |
1902 .Times(0); | 1897 .Times(0); |
1903 EXPECT_CALL(*time_wait_list_manager_, | 1898 EXPECT_CALL(*time_wait_list_manager_, |
1904 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); | 1899 AddConnectionIdToTimeWait(conn_id_1, _, true, _)); |
1905 EXPECT_CALL(*time_wait_list_manager_, | 1900 EXPECT_CALL(*time_wait_list_manager_, |
1906 ProcessPacket(_, client_addr_, conn_id_1, _, _)); | 1901 ProcessPacket(_, client_addr_, conn_id_1, _)); |
1907 } | 1902 } |
1908 | 1903 |
1909 // Send a CHLO that the StatelessRejector will reject. | 1904 // Send a CHLO that the StatelessRejector will reject. |
1910 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); | 1905 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); |
1911 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1906 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1912 EXPECT_FALSE(store->HasBufferedPackets(conn_id_1)); | 1907 EXPECT_FALSE(store->HasBufferedPackets(conn_id_1)); |
1913 | 1908 |
1914 // Send an identical CHLO which should get buffered. | 1909 // Send an identical CHLO which should get buffered. |
1915 check.Call(1); | 1910 check.Call(1); |
1916 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); | 1911 ProcessPacket(client_addr_, conn_id_1, true, SerializeCHLO()); |
(...skipping 19 matching lines...) Expand all Loading... |
1936 QuicBufferedPacketStorePeer::set_clock(store, mock_helper_.GetClock()); | 1931 QuicBufferedPacketStorePeer::set_clock(store, mock_helper_.GetClock()); |
1937 | 1932 |
1938 testing::MockFunction<void(int check_point)> check; | 1933 testing::MockFunction<void(int check_point)> check; |
1939 { | 1934 { |
1940 InSequence s; | 1935 InSequence s; |
1941 EXPECT_CALL(check, Call(1)); | 1936 EXPECT_CALL(check, Call(1)); |
1942 EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); | 1937 EXPECT_CALL(*dispatcher_, ShouldCreateOrBufferPacketForConnection(conn_id)); |
1943 | 1938 |
1944 EXPECT_CALL(check, Call(2)); | 1939 EXPECT_CALL(check, Call(2)); |
1945 EXPECT_CALL(*time_wait_list_manager_, | 1940 EXPECT_CALL(*time_wait_list_manager_, |
1946 ProcessPacket(_, client_addr_, conn_id, _, _)); | 1941 ProcessPacket(_, client_addr_, conn_id, _)); |
1947 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) | 1942 EXPECT_CALL(*dispatcher_, CreateQuicSession(conn_id, client_addr_)) |
1948 .Times(0); | 1943 .Times(0); |
1949 } | 1944 } |
1950 | 1945 |
1951 // Send a CHLO that the StatelessRejector will accept. | 1946 // Send a CHLO that the StatelessRejector will accept. |
1952 ProcessPacket(client_addr_, conn_id, true, SerializeFullCHLO()); | 1947 ProcessPacket(client_addr_, conn_id, true, SerializeFullCHLO()); |
1953 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); | 1948 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 1); |
1954 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); | 1949 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); |
1955 | 1950 |
1956 // Send a data packet that will get buffered | 1951 // Send a data packet that will get buffered |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 check.Call(2); | 2037 check.Call(2); |
2043 GetFakeProofSource()->InvokePendingCallback(0); | 2038 GetFakeProofSource()->InvokePendingCallback(0); |
2044 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); | 2039 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); |
2045 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); | 2040 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); |
2046 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); | 2041 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); |
2047 } | 2042 } |
2048 | 2043 |
2049 } // namespace | 2044 } // namespace |
2050 } // namespace test | 2045 } // namespace test |
2051 } // namespace net | 2046 } // namespace net |
OLD | NEW |