Chromium Code Reviews| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 stream_requests_.pop_front(); | 586 stream_requests_.pop_front(); |
| 587 request->OnRequestCompleteSuccess(CreateOutgoingReliableStreamImpl()); | 587 request->OnRequestCompleteSuccess(CreateOutgoingReliableStreamImpl()); |
| 588 } | 588 } |
| 589 | 589 |
| 590 if (GetNumOpenStreams() == 0) { | 590 if (GetNumOpenStreams() == 0) { |
| 591 stream_factory_->OnIdleSession(this); | 591 stream_factory_->OnIdleSession(this); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { | 595 void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
| 596 if (stream_factory_ && event == HANDSHAKE_CONFIRMED) { | |
| 597 float packet_loss_rate = logger_->PacketLossRate() / 10; | |
|
Ryan Hamilton
2015/03/23 02:31:06
Why / 10?
ramant (doing other things)
2015/03/24 03:07:22
Remove the percent. Used fraction.
| |
| 598 if (packet_loss_rate > stream_factory_->packet_loss_threshold()) { | |
| 599 stream_factory_->OnBadPacketLoss(server_id_); | |
|
Ryan Hamilton
2015/03/23 02:31:06
I wonder if it might make more sense for this to b
ramant (doing other things)
2015/03/24 03:07:22
Done.
| |
| 600 // We abandon the connection if packet loss rate is too bad. | |
| 601 DVLOG(1) << "Closing session on bad packet loss rate: " | |
| 602 << packet_loss_rate; | |
| 603 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.HasBadPacketLossRate", true); | |
| 604 NotifyFactoryOfSessionGoingAway(); | |
| 605 CloseSessionOnErrorInner(ERR_ABORTED, QUIC_BAD_PACKET_LOSS_RATE); | |
| 606 NotifyFactoryOfSessionClosedLater(); | |
|
Ryan Hamilton
2015/03/23 02:31:06
Is there a method the factory could call which wou
ramant (doing other things)
2015/03/24 03:07:22
Called CloseSessionOnError from QuicStreamFactory.
| |
| 607 return; | |
| 608 } | |
| 609 } | |
| 610 | |
| 596 if (!callback_.is_null() && | 611 if (!callback_.is_null() && |
| 597 (!require_confirmation_ || | 612 (!require_confirmation_ || |
| 598 event == HANDSHAKE_CONFIRMED || event == ENCRYPTION_REESTABLISHED)) { | 613 event == HANDSHAKE_CONFIRMED || event == ENCRYPTION_REESTABLISHED)) { |
| 599 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ | 614 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ |
| 600 // could be called because there are no error events in CryptoHandshakeEvent | 615 // could be called because there are no error events in CryptoHandshakeEvent |
| 601 // enum. If error events are added to CryptoHandshakeEvent, then the | 616 // enum. If error events are added to CryptoHandshakeEvent, then the |
| 602 // following code needs to changed. | 617 // following code needs to changed. |
| 603 base::ResetAndReturn(&callback_).Run(OK); | 618 base::ResetAndReturn(&callback_).Run(OK); |
| 604 } | 619 } |
| 605 if (event == HANDSHAKE_CONFIRMED) { | 620 if (event == HANDSHAKE_CONFIRMED) { |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 910 return; | 925 return; |
| 911 | 926 |
| 912 // TODO(rch): re-enable this code once beta is cut. | 927 // TODO(rch): re-enable this code once beta is cut. |
| 913 // if (stream_factory_) | 928 // if (stream_factory_) |
| 914 // stream_factory_->OnSessionConnectTimeout(this); | 929 // stream_factory_->OnSessionConnectTimeout(this); |
| 915 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 930 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
| 916 // DCHECK_EQ(0u, GetNumOpenStreams()); | 931 // DCHECK_EQ(0u, GetNumOpenStreams()); |
| 917 } | 932 } |
| 918 | 933 |
| 919 } // namespace net | 934 } // namespace net |
| OLD | NEW |