| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 CloseConnection(QUIC_PUBLIC_RESET, true); | 173 CloseConnection(QUIC_PUBLIC_RESET, true); |
| 174 } | 174 } |
| 175 | 175 |
| 176 bool QuicConnection::OnProtocolVersionMismatch( | 176 bool QuicConnection::OnProtocolVersionMismatch( |
| 177 QuicVersionTag received_version) { | 177 QuicVersionTag received_version) { |
| 178 // TODO(satyamshekhar): Implement no server state in this mode. | 178 // TODO(satyamshekhar): Implement no server state in this mode. |
| 179 if (!is_server_) { | 179 if (!is_server_) { |
| 180 LOG(DFATAL) << "Framer called OnProtocolVersionMismatch for server. " | 180 LOG(DFATAL) << "Framer called OnProtocolVersionMismatch for server. " |
| 181 << "Closing connection."; | 181 << "Closing connection."; |
| 182 CloseConnection(QUIC_INTERNAL_ERROR, false); | 182 CloseConnection(QUIC_INTERNAL_ERROR, false); |
| 183 return false; |
| 183 } | 184 } |
| 184 DCHECK_NE(quic_version_, received_version); | 185 DCHECK_NE(quic_version_, received_version); |
| 185 | 186 |
| 186 if (debug_visitor_) { | 187 if (debug_visitor_) { |
| 187 debug_visitor_->OnProtocolVersionMismatch(received_version); | 188 debug_visitor_->OnProtocolVersionMismatch(received_version); |
| 188 } | 189 } |
| 189 | 190 |
| 190 switch (version_negotiation_state_) { | 191 switch (version_negotiation_state_) { |
| 191 case START_NEGOTIATION: | 192 case START_NEGOTIATION: |
| 192 if (!framer_.IsSupportedVersion(received_version)) { | 193 if (!framer_.IsSupportedVersion(received_version)) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 // Handles version negotiation for client connection. | 226 // Handles version negotiation for client connection. |
| 226 void QuicConnection::OnVersionNegotiationPacket( | 227 void QuicConnection::OnVersionNegotiationPacket( |
| 227 const QuicVersionNegotiationPacket& packet) { | 228 const QuicVersionNegotiationPacket& packet) { |
| 228 if (is_server_) { | 229 if (is_server_) { |
| 229 LOG(DFATAL) << "Framer parsed VersionNegotiationPacket for server." | 230 LOG(DFATAL) << "Framer parsed VersionNegotiationPacket for server." |
| 230 << "Closing connection."; | 231 << "Closing connection."; |
| 231 CloseConnection(QUIC_INTERNAL_ERROR, false); | 232 CloseConnection(QUIC_INTERNAL_ERROR, false); |
| 233 return; |
| 232 } | 234 } |
| 233 if (debug_visitor_) { | 235 if (debug_visitor_) { |
| 234 debug_visitor_->OnVersionNegotiationPacket(packet); | 236 debug_visitor_->OnVersionNegotiationPacket(packet); |
| 235 } | 237 } |
| 236 | 238 |
| 237 if (version_negotiation_state_ == NEGOTIATED_VERSION) { | 239 if (version_negotiation_state_ == NEGOTIATED_VERSION) { |
| 238 // Possibly a duplicate version negotiation packet. | 240 // Possibly a duplicate version negotiation packet. |
| 239 return; | 241 return; |
| 240 } | 242 } |
| 241 | 243 |
| (...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 << " delta:" << delta.ToMicroseconds(); | 1244 << " delta:" << delta.ToMicroseconds(); |
| 1243 if (delta >= timeout_) { | 1245 if (delta >= timeout_) { |
| 1244 SendConnectionClose(QUIC_CONNECTION_TIMED_OUT); | 1246 SendConnectionClose(QUIC_CONNECTION_TIMED_OUT); |
| 1245 return true; | 1247 return true; |
| 1246 } | 1248 } |
| 1247 helper_->SetTimeoutAlarm(timeout_.Subtract(delta)); | 1249 helper_->SetTimeoutAlarm(timeout_.Subtract(delta)); |
| 1248 return false; | 1250 return false; |
| 1249 } | 1251 } |
| 1250 | 1252 |
| 1251 } // namespace net | 1253 } // namespace net |
| OLD | NEW |