Index: net/tools/quic/end_to_end_test.cc |
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc |
index 6ae2622d0a0e0da4f7f662e76b89054e3d5a2b52..0f2e9c527ac577e4e1af45d6dd0213df32dd5a47 100644 |
--- a/net/tools/quic/end_to_end_test.cc |
+++ b/net/tools/quic/end_to_end_test.cc |
@@ -1000,10 +1000,10 @@ TEST_P(EndToEndTest, ConnectionMigrationClientPortChanged) { |
EpollServer* eps = client_->client()->epoll_server(); |
int old_fd = client_->client()->fd(); |
eps->UnregisterFD(old_fd); |
- close(old_fd); |
- |
- // Create a new socket, which will result in a new ephemeral port. |
+ // Create a new socket before closing the old one, which will result in a new |
+ // ephemeral port. |
QuicClientPeer::CreateUDPSocket(client_->client()); |
+ close(old_fd); |
// The packet writer needs to be updated to use the new FD. |
client_->client()->CreateQuicPacketWriter(); |