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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 #include <sys/epoll.h> | 7 #include <sys/epoll.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 VerifyCleanConnection(false); | 755 VerifyCleanConnection(false); |
756 } | 756 } |
757 | 757 |
758 TEST_P(EndToEndTest, DoNotSetResumeWriteAlarmIfConnectionFlowControlBlocked) { | 758 TEST_P(EndToEndTest, DoNotSetResumeWriteAlarmIfConnectionFlowControlBlocked) { |
759 // Regression test for b/14677858. | 759 // Regression test for b/14677858. |
760 // Test that the resume write alarm is not set in QuicConnection::OnCanWrite | 760 // Test that the resume write alarm is not set in QuicConnection::OnCanWrite |
761 // if currently connection level flow control blocked. If set, this results in | 761 // if currently connection level flow control blocked. If set, this results in |
762 // an infinite loop in the EpollServer, as the alarm fires and is immediately | 762 // an infinite loop in the EpollServer, as the alarm fires and is immediately |
763 // rescheduled. | 763 // rescheduled. |
764 ASSERT_TRUE(Initialize()); | 764 ASSERT_TRUE(Initialize()); |
765 if (negotiated_version_ < QUIC_VERSION_19) { | |
766 return; | |
767 } | |
768 client_->client()->WaitForCryptoHandshakeConfirmed(); | 765 client_->client()->WaitForCryptoHandshakeConfirmed(); |
769 | 766 |
770 // Ensure both stream and connection level are flow control blocked by setting | 767 // Ensure both stream and connection level are flow control blocked by setting |
771 // the send window offset to 0. | 768 // the send window offset to 0. |
772 const uint64 kFlowControlWindow = | 769 const uint64 kFlowControlWindow = |
773 server_config_.GetInitialFlowControlWindowToSend(); | 770 server_config_.GetInitialFlowControlWindowToSend(); |
774 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); | 771 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); |
775 QuicSession* session = client_->client()->session(); | 772 QuicSession* session = client_->client()->session(); |
776 QuicFlowControllerPeer::SetSendWindowOffset(stream->flow_controller(), 0); | 773 QuicFlowControllerPeer::SetSendWindowOffset(stream->flow_controller(), 0); |
777 QuicFlowControllerPeer::SetSendWindowOffset(session->flow_controller(), 0); | 774 QuicFlowControllerPeer::SetSendWindowOffset(session->flow_controller(), 0); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 const uint32 kClientSessionIFCW = 234567; | 1235 const uint32 kClientSessionIFCW = 234567; |
1239 set_client_initial_stream_flow_control_receive_window(kClientStreamIFCW); | 1236 set_client_initial_stream_flow_control_receive_window(kClientStreamIFCW); |
1240 set_client_initial_session_flow_control_receive_window(kClientSessionIFCW); | 1237 set_client_initial_session_flow_control_receive_window(kClientSessionIFCW); |
1241 | 1238 |
1242 const uint32 kServerStreamIFCW = 654321; | 1239 const uint32 kServerStreamIFCW = 654321; |
1243 const uint32 kServerSessionIFCW = 765432; | 1240 const uint32 kServerSessionIFCW = 765432; |
1244 set_server_initial_stream_flow_control_receive_window(kServerStreamIFCW); | 1241 set_server_initial_stream_flow_control_receive_window(kServerStreamIFCW); |
1245 set_server_initial_session_flow_control_receive_window(kServerSessionIFCW); | 1242 set_server_initial_session_flow_control_receive_window(kServerSessionIFCW); |
1246 | 1243 |
1247 ASSERT_TRUE(Initialize()); | 1244 ASSERT_TRUE(Initialize()); |
1248 if (negotiated_version_ <= QUIC_VERSION_19) { | 1245 if (negotiated_version_ == QUIC_VERSION_19) { |
1249 return; | 1246 return; |
1250 } | 1247 } |
1251 | 1248 |
1252 // Values are exchanged during crypto handshake, so wait for that to finish. | 1249 // Values are exchanged during crypto handshake, so wait for that to finish. |
1253 client_->client()->WaitForCryptoHandshakeConfirmed(); | 1250 client_->client()->WaitForCryptoHandshakeConfirmed(); |
1254 server_thread_->WaitForCryptoHandshakeConfirmed(); | 1251 server_thread_->WaitForCryptoHandshakeConfirmed(); |
1255 | 1252 |
1256 // Open a data stream to make sure the stream level flow control is updated. | 1253 // Open a data stream to make sure the stream level flow control is updated. |
1257 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); | 1254 QuicSpdyClientStream* stream = client_->GetOrCreateStream(); |
1258 stream->SendBody("hello", false); | 1255 stream->SendBody("hello", false); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 QuicSession* session = dispatcher->session_map().begin()->second; | 1357 QuicSession* session = dispatcher->session_map().begin()->second; |
1361 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( | 1358 EXPECT_EQ(0u, QuicSessionPeer::GetLocallyClosedStreamsHighestOffset( |
1362 session).size()); | 1359 session).size()); |
1363 server_thread_->Resume(); | 1360 server_thread_->Resume(); |
1364 } | 1361 } |
1365 | 1362 |
1366 } // namespace | 1363 } // namespace |
1367 } // namespace test | 1364 } // namespace test |
1368 } // namespace tools | 1365 } // namespace tools |
1369 } // namespace net | 1366 } // namespace net |
OLD | NEW |