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_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 if (stats != NULL) { | 881 if (stats != NULL) { |
882 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 882 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); |
883 } | 883 } |
884 } | 884 } |
885 | 885 |
886 *session = new QuicClientSession( | 886 *session = new QuicClientSession( |
887 connection, socket.Pass(), this, transport_security_state_, | 887 connection, socket.Pass(), this, transport_security_state_, |
888 server_info.Pass(), config, | 888 server_info.Pass(), config, |
889 base::MessageLoop::current()->message_loop_proxy().get(), | 889 base::MessageLoop::current()->message_loop_proxy().get(), |
890 net_log.net_log()); | 890 net_log.net_log()); |
| 891 all_sessions_[*session] = server_id; // owning pointer |
891 (*session)->InitializeSession(server_id, &crypto_config_, | 892 (*session)->InitializeSession(server_id, &crypto_config_, |
892 quic_crypto_client_stream_factory_); | 893 quic_crypto_client_stream_factory_); |
893 all_sessions_[*session] = server_id; // owning pointer | 894 bool closed_during_initialize = !ContainsKey(all_sessions_, *session); |
| 895 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", |
| 896 closed_during_initialize); |
| 897 if (closed_during_initialize) { |
| 898 DLOG(DFATAL) << "Session closed during initialize"; |
| 899 *session = NULL; |
| 900 return ERR_CONNECTION_CLOSED; |
| 901 } |
894 return OK; | 902 return OK; |
895 } | 903 } |
896 | 904 |
897 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { | 905 bool QuicStreamFactory::HasActiveJob(const QuicServerId& key) const { |
898 return ContainsKey(active_jobs_, key); | 906 return ContainsKey(active_jobs_, key); |
899 } | 907 } |
900 | 908 |
901 void QuicStreamFactory::ActivateSession( | 909 void QuicStreamFactory::ActivateSession( |
902 const QuicServerId& server_id, | 910 const QuicServerId& server_id, |
903 QuicClientSession* session) { | 911 QuicClientSession* session) { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 http_server_properties_->ClearAlternateProtocol(server); | 992 http_server_properties_->ClearAlternateProtocol(server); |
985 http_server_properties_->SetAlternateProtocol( | 993 http_server_properties_->SetAlternateProtocol( |
986 server, alternate.port, alternate.protocol, 1); | 994 server, alternate.port, alternate.protocol, 1); |
987 DCHECK_EQ(QUIC, | 995 DCHECK_EQ(QUIC, |
988 http_server_properties_->GetAlternateProtocol(server).protocol); | 996 http_server_properties_->GetAlternateProtocol(server).protocol); |
989 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 997 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
990 server)); | 998 server)); |
991 } | 999 } |
992 | 1000 |
993 } // namespace net | 1001 } // namespace net |
OLD | NEW |