| 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 <sys/epoll.h> | 6 #include <sys/epoll.h> |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // Use different flow control windows for client/server. | 293 // Use different flow control windows for client/server. |
| 294 client_config_.SetInitialStreamFlowControlWindowToSend( | 294 client_config_.SetInitialStreamFlowControlWindowToSend( |
| 295 2 * kInitialStreamFlowControlWindowForTest); | 295 2 * kInitialStreamFlowControlWindowForTest); |
| 296 client_config_.SetInitialSessionFlowControlWindowToSend( | 296 client_config_.SetInitialSessionFlowControlWindowToSend( |
| 297 2 * kInitialSessionFlowControlWindowForTest); | 297 2 * kInitialSessionFlowControlWindowForTest); |
| 298 server_config_.SetInitialStreamFlowControlWindowToSend( | 298 server_config_.SetInitialStreamFlowControlWindowToSend( |
| 299 3 * kInitialStreamFlowControlWindowForTest); | 299 3 * kInitialStreamFlowControlWindowForTest); |
| 300 server_config_.SetInitialSessionFlowControlWindowToSend( | 300 server_config_.SetInitialSessionFlowControlWindowToSend( |
| 301 3 * kInitialSessionFlowControlWindowForTest); | 301 3 * kInitialSessionFlowControlWindowForTest); |
| 302 | 302 |
| 303 // The default idle timeouts can be too strict when running on a busy |
| 304 // machine. |
| 305 const QuicTime::Delta timeout = QuicTime::Delta::FromSeconds(30); |
| 306 client_config_.set_max_time_before_crypto_handshake(timeout); |
| 307 client_config_.set_max_idle_time_before_crypto_handshake(timeout); |
| 308 server_config_.set_max_time_before_crypto_handshake(timeout); |
| 309 server_config_.set_max_idle_time_before_crypto_handshake(timeout); |
| 310 |
| 303 QuicInMemoryCachePeer::ResetForTests(); | 311 QuicInMemoryCachePeer::ResetForTests(); |
| 304 AddToCache("/foo", 200, kFooResponseBody); | 312 AddToCache("/foo", 200, kFooResponseBody); |
| 305 AddToCache("/bar", 200, kBarResponseBody); | 313 AddToCache("/bar", 200, kBarResponseBody); |
| 306 } | 314 } |
| 307 | 315 |
| 308 ~EndToEndTest() override { | 316 ~EndToEndTest() override { |
| 309 // TODO(rtenneti): port RecycleUnusedPort if needed. | 317 // TODO(rtenneti): port RecycleUnusedPort if needed. |
| 310 // RecycleUnusedPort(server_address_.port()); | 318 // RecycleUnusedPort(server_address_.port()); |
| 311 QuicInMemoryCachePeer::ResetForTests(); | 319 QuicInMemoryCachePeer::ResetForTests(); |
| 312 } | 320 } |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 // Tests that the client's port can change during an established QUIC | 1475 // Tests that the client's port can change during an established QUIC |
| 1468 // connection, and that doing so does not result in the connection being | 1476 // connection, and that doing so does not result in the connection being |
| 1469 // closed by the server. | 1477 // closed by the server. |
| 1470 ASSERT_TRUE(Initialize()); | 1478 ASSERT_TRUE(Initialize()); |
| 1471 | 1479 |
| 1472 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); | 1480 EXPECT_EQ(kFooResponseBody, client_->SendSynchronousRequest("/foo")); |
| 1473 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); | 1481 EXPECT_EQ(200u, client_->response_headers()->parsed_response_code()); |
| 1474 | 1482 |
| 1475 // Store the client address which was used to send the first request. | 1483 // Store the client address which was used to send the first request. |
| 1476 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); | 1484 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); |
| 1477 | 1485 int old_fd = client_->client()->GetLatestFD(); |
| 1478 // Stop listening and close the old FD. | |
| 1479 QuicClientPeer::CleanUpUDPSocket(client_->client(), | |
| 1480 client_->client()->GetLatestFD()); | |
| 1481 | 1486 |
| 1482 // Create a new socket before closing the old one, which will result in a new | 1487 // Create a new socket before closing the old one, which will result in a new |
| 1483 // ephemeral port. | 1488 // ephemeral port. |
| 1484 QuicClientPeer::CreateUDPSocketAndBind(client_->client()); | 1489 QuicClientPeer::CreateUDPSocketAndBind(client_->client()); |
| 1485 | 1490 |
| 1491 // Stop listening and close the old FD. |
| 1492 QuicClientPeer::CleanUpUDPSocket(client_->client(), old_fd); |
| 1493 |
| 1486 // The packet writer needs to be updated to use the new FD. | 1494 // The packet writer needs to be updated to use the new FD. |
| 1487 client_->client()->CreateQuicPacketWriter(); | 1495 client_->client()->CreateQuicPacketWriter(); |
| 1488 | 1496 |
| 1489 // Change the internal state of the client and connection to use the new port, | 1497 // Change the internal state of the client and connection to use the new port, |
| 1490 // this is done because in a real NAT rebinding the client wouldn't see any | 1498 // this is done because in a real NAT rebinding the client wouldn't see any |
| 1491 // port change, and so expects no change to incoming port. | 1499 // port change, and so expects no change to incoming port. |
| 1492 // This is kind of ugly, but needed as we are simply swapping out the client | 1500 // This is kind of ugly, but needed as we are simply swapping out the client |
| 1493 // FD rather than any more complex NAT rebinding simulation. | 1501 // FD rather than any more complex NAT rebinding simulation. |
| 1494 int new_port = client_->client()->GetLatestClientAddress().port(); | 1502 int new_port = client_->client()->GetLatestClientAddress().port(); |
| 1495 QuicClientPeer::SetClientPort(client_->client(), new_port); | 1503 QuicClientPeer::SetClientPort(client_->client(), new_port); |
| (...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 client_->WaitForResponse(); | 2695 client_->WaitForResponse(); |
| 2688 // TODO(fayang): Fix this test to work with stateless rejects. | 2696 // TODO(fayang): Fix this test to work with stateless rejects. |
| 2689 if (!BothSidesSupportStatelessRejects()) { | 2697 if (!BothSidesSupportStatelessRejects()) { |
| 2690 VerifyCleanConnection(false); | 2698 VerifyCleanConnection(false); |
| 2691 } | 2699 } |
| 2692 } | 2700 } |
| 2693 | 2701 |
| 2694 } // namespace | 2702 } // namespace |
| 2695 } // namespace test | 2703 } // namespace test |
| 2696 } // namespace net | 2704 } // namespace net |
| OLD | NEW |