| 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 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 | 1501 |
| 1502 // Store the client address which was used to send the first request. | 1502 // Store the client address which was used to send the first request. |
| 1503 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); | 1503 IPEndPoint old_address = client_->client()->GetLatestClientAddress(); |
| 1504 | 1504 |
| 1505 // Stop listening and close the old FD. | 1505 // Stop listening and close the old FD. |
| 1506 QuicClientPeer::CleanUpUDPSocket(client_->client(), | 1506 QuicClientPeer::CleanUpUDPSocket(client_->client(), |
| 1507 client_->client()->GetLatestFD()); | 1507 client_->client()->GetLatestFD()); |
| 1508 | 1508 |
| 1509 // Create a new socket before closing the old one, which will result in a new | 1509 // Create a new socket before closing the old one, which will result in a new |
| 1510 // ephemeral port. | 1510 // ephemeral port. |
| 1511 QuicClientPeer::CreateUDPSocket(client_->client()); | 1511 QuicClientPeer::CreateUDPSocketAndBind(client_->client()); |
| 1512 | 1512 |
| 1513 // The packet writer needs to be updated to use the new FD. | 1513 // The packet writer needs to be updated to use the new FD. |
| 1514 client_->client()->CreateQuicPacketWriter(); | 1514 client_->client()->CreateQuicPacketWriter(); |
| 1515 | 1515 |
| 1516 // Change the internal state of the client and connection to use the new port, | 1516 // Change the internal state of the client and connection to use the new port, |
| 1517 // this is done because in a real NAT rebinding the client wouldn't see any | 1517 // this is done because in a real NAT rebinding the client wouldn't see any |
| 1518 // port change, and so expects no change to incoming port. | 1518 // port change, and so expects no change to incoming port. |
| 1519 // This is kind of ugly, but needed as we are simply swapping out the client | 1519 // This is kind of ugly, but needed as we are simply swapping out the client |
| 1520 // FD rather than any more complex NAT rebinding simulation. | 1520 // FD rather than any more complex NAT rebinding simulation. |
| 1521 int new_port = client_->client()->GetLatestClientAddress().port(); | 1521 int new_port = client_->client()->GetLatestClientAddress().port(); |
| (...skipping 903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 // sending requests for them. | 2425 // sending requests for them. |
| 2426 EXPECT_EQ(1u, client_->num_requests()); | 2426 EXPECT_EQ(1u, client_->num_requests()); |
| 2427 // Including response to original request, 12 responses in total were | 2427 // Including response to original request, 12 responses in total were |
| 2428 // recieved. | 2428 // recieved. |
| 2429 EXPECT_EQ(12u, client_->num_responses()); | 2429 EXPECT_EQ(12u, client_->num_responses()); |
| 2430 } | 2430 } |
| 2431 | 2431 |
| 2432 } // namespace | 2432 } // namespace |
| 2433 } // namespace test | 2433 } // namespace test |
| 2434 } // namespace net | 2434 } // namespace net |
| OLD | NEW |