| 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/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 } | 1172 } |
| 1173 } | 1173 } |
| 1174 | 1174 |
| 1175 void QuicConnection::WriteIfNotBlocked() { | 1175 void QuicConnection::WriteIfNotBlocked() { |
| 1176 if (!writer_->IsWriteBlocked()) { | 1176 if (!writer_->IsWriteBlocked()) { |
| 1177 OnCanWrite(); | 1177 OnCanWrite(); |
| 1178 } | 1178 } |
| 1179 } | 1179 } |
| 1180 | 1180 |
| 1181 bool QuicConnection::ProcessValidatedPacket() { | 1181 bool QuicConnection::ProcessValidatedPacket() { |
| 1182 if ((!FLAGS_quic_allow_port_migration && peer_port_changed_) || | 1182 if (peer_ip_changed_ || self_ip_changed_ || self_port_changed_) { |
| 1183 peer_ip_changed_ || self_ip_changed_ || self_port_changed_) { | |
| 1184 SendConnectionCloseWithDetails( | 1183 SendConnectionCloseWithDetails( |
| 1185 QUIC_ERROR_MIGRATING_ADDRESS, | 1184 QUIC_ERROR_MIGRATING_ADDRESS, |
| 1186 "Neither IP address migration, nor self port migration are supported."); | 1185 "Neither IP address migration, nor self port migration are supported."); |
| 1187 return false; | 1186 return false; |
| 1188 } | 1187 } |
| 1189 | 1188 |
| 1190 // Port migration is supported, do it now if port has changed. | 1189 // Peer port migration is supported, do it now if port has changed. |
| 1191 if (FLAGS_quic_allow_port_migration && | 1190 if (peer_port_changed_) { |
| 1192 peer_port_changed_) { | |
| 1193 DVLOG(1) << ENDPOINT << "Peer's port changed from " | 1191 DVLOG(1) << ENDPOINT << "Peer's port changed from " |
| 1194 << peer_address_.port() << " to " << migrating_peer_port_ | 1192 << peer_address_.port() << " to " << migrating_peer_port_ |
| 1195 << ", migrating connection."; | 1193 << ", migrating connection."; |
| 1196 peer_address_ = IPEndPoint(peer_address_.address(), migrating_peer_port_); | 1194 peer_address_ = IPEndPoint(peer_address_.address(), migrating_peer_port_); |
| 1197 } | 1195 } |
| 1198 | 1196 |
| 1199 time_of_last_received_packet_ = clock_->Now(); | 1197 time_of_last_received_packet_ = clock_->Now(); |
| 1200 DVLOG(1) << ENDPOINT << "time of last received packet: " | 1198 DVLOG(1) << ENDPOINT << "time of last received packet: " |
| 1201 << time_of_last_received_packet_.ToDebuggingValue(); | 1199 << time_of_last_received_packet_.ToDebuggingValue(); |
| 1202 | 1200 |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 // If we changed the generator's batch state, restore original batch state. | 1988 // If we changed the generator's batch state, restore original batch state. |
| 1991 if (!already_in_batch_mode_) { | 1989 if (!already_in_batch_mode_) { |
| 1992 DVLOG(1) << "Leaving Batch Mode."; | 1990 DVLOG(1) << "Leaving Batch Mode."; |
| 1993 connection_->packet_generator_.FinishBatchOperations(); | 1991 connection_->packet_generator_.FinishBatchOperations(); |
| 1994 } | 1992 } |
| 1995 DCHECK_EQ(already_in_batch_mode_, | 1993 DCHECK_EQ(already_in_batch_mode_, |
| 1996 connection_->packet_generator_.InBatchMode()); | 1994 connection_->packet_generator_.InBatchMode()); |
| 1997 } | 1995 } |
| 1998 | 1996 |
| 1999 } // namespace net | 1997 } // namespace net |
| OLD | NEW |