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_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const CryptoHandshakeMessage& message) { | 303 const CryptoHandshakeMessage& message) { |
304 logger_.OnCryptoHandshakeMessageSent(message); | 304 logger_.OnCryptoHandshakeMessageSent(message); |
305 } | 305 } |
306 | 306 |
307 void QuicClientSession::OnCryptoHandshakeMessageReceived( | 307 void QuicClientSession::OnCryptoHandshakeMessageReceived( |
308 const CryptoHandshakeMessage& message) { | 308 const CryptoHandshakeMessage& message) { |
309 logger_.OnCryptoHandshakeMessageReceived(message); | 309 logger_.OnCryptoHandshakeMessageReceived(message); |
310 } | 310 } |
311 | 311 |
312 void QuicClientSession::ConnectionClose(QuicErrorCode error, bool from_peer) { | 312 void QuicClientSession::ConnectionClose(QuicErrorCode error, bool from_peer) { |
| 313 DCHECK(!connection()->connected()); |
313 logger_.OnConnectionClose(error, from_peer); | 314 logger_.OnConnectionClose(error, from_peer); |
314 if (from_peer) { | 315 if (from_peer) { |
315 UMA_HISTOGRAM_SPARSE_SLOWLY( | 316 UMA_HISTOGRAM_SPARSE_SLOWLY( |
316 "Net.QuicSession.ConnectionCloseErrorCodeServer", error); | 317 "Net.QuicSession.ConnectionCloseErrorCodeServer", error); |
317 } else { | 318 } else { |
318 UMA_HISTOGRAM_SPARSE_SLOWLY( | 319 UMA_HISTOGRAM_SPARSE_SLOWLY( |
319 "Net.QuicSession.ConnectionCloseErrorCodeClient", error); | 320 "Net.QuicSession.ConnectionCloseErrorCodeClient", error); |
320 } | 321 } |
321 | 322 |
322 if (error == QUIC_CONNECTION_TIMED_OUT) { | 323 if (error == QUIC_CONNECTION_TIMED_OUT) { |
323 UMA_HISTOGRAM_SPARSE_SLOWLY( | 324 UMA_HISTOGRAM_SPARSE_SLOWLY( |
324 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", | 325 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", |
325 GetNumOpenStreams()); | 326 GetNumOpenStreams()); |
326 } | 327 } |
327 | 328 |
328 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", | 329 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", |
329 connection()->version()); | 330 connection()->version()); |
330 if (!callback_.is_null()) { | 331 if (!callback_.is_null()) { |
331 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); | 332 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); |
332 } | 333 } |
| 334 socket_->Close(); |
333 QuicSession::ConnectionClose(error, from_peer); | 335 QuicSession::ConnectionClose(error, from_peer); |
334 NotifyFactoryOfSessionCloseLater(); | 336 NotifyFactoryOfSessionCloseLater(); |
335 } | 337 } |
336 | 338 |
337 void QuicClientSession::OnSuccessfulVersionNegotiation( | 339 void QuicClientSession::OnSuccessfulVersionNegotiation( |
338 const QuicVersion& version) { | 340 const QuicVersion& version) { |
339 logger_.OnSuccessfulVersionNegotiation(version); | 341 logger_.OnSuccessfulVersionNegotiation(version); |
340 QuicSession::OnSuccessfulVersionNegotiation(version); | 342 QuicSession::OnSuccessfulVersionNegotiation(version); |
341 } | 343 } |
342 | 344 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 } | 444 } |
443 | 445 |
444 void QuicClientSession::NotifyFactoryOfSessionClose() { | 446 void QuicClientSession::NotifyFactoryOfSessionClose() { |
445 DCHECK_EQ(0u, GetNumOpenStreams()); | 447 DCHECK_EQ(0u, GetNumOpenStreams()); |
446 DCHECK(stream_factory_); | 448 DCHECK(stream_factory_); |
447 // Will delete |this|. | 449 // Will delete |this|. |
448 stream_factory_->OnSessionClose(this); | 450 stream_factory_->OnSessionClose(this); |
449 } | 451 } |
450 | 452 |
451 } // namespace net | 453 } // namespace net |
OLD | NEW |