Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: net/quic/quic_stream_factory.cc

Issue 579533003: Correctly fix a bug when a QUIC session is closed during the call to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: typo Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 io_state_ = STATE_CONNECT_COMPLETE; 373 io_state_ = STATE_CONNECT_COMPLETE;
374 374
375 int rv = factory_->CreateSession(server_id_, server_info_.Pass(), 375 int rv = factory_->CreateSession(server_id_, server_info_.Pass(),
376 address_list_, net_log_, &session_); 376 address_list_, net_log_, &session_);
377 if (rv != OK) { 377 if (rv != OK) {
378 DCHECK(rv != ERR_IO_PENDING); 378 DCHECK(rv != ERR_IO_PENDING);
379 DCHECK(!session_); 379 DCHECK(!session_);
380 return rv; 380 return rv;
381 } 381 }
382 382
383 if (!session_->connection()->connected()) {
384 return ERR_CONNECTION_CLOSED;
385 }
386
383 session_->StartReading(); 387 session_->StartReading();
384 if (!session_->connection()->connected()) { 388 if (!session_->connection()->connected()) {
385 return ERR_QUIC_PROTOCOL_ERROR; 389 return ERR_QUIC_PROTOCOL_ERROR;
386 } 390 }
387 bool require_confirmation = 391 bool require_confirmation =
388 factory_->require_confirmation() || is_post_ || 392 factory_->require_confirmation() || is_post_ ||
389 was_alternate_protocol_recently_broken_; 393 was_alternate_protocol_recently_broken_;
390 rv = session_->CryptoConnect( 394 rv = session_->CryptoConnect(
391 require_confirmation, 395 require_confirmation,
392 base::Bind(&QuicStreamFactory::Job::OnIOComplete, 396 base::Bind(&QuicStreamFactory::Job::OnIOComplete,
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 } 893 }
890 894
891 *session = new QuicClientSession( 895 *session = new QuicClientSession(
892 connection, socket.Pass(), this, transport_security_state_, 896 connection, socket.Pass(), this, transport_security_state_,
893 server_info.Pass(), config, 897 server_info.Pass(), config,
894 base::MessageLoop::current()->message_loop_proxy().get(), 898 base::MessageLoop::current()->message_loop_proxy().get(),
895 net_log.net_log()); 899 net_log.net_log());
896 all_sessions_[*session] = server_id; // owning pointer 900 all_sessions_[*session] = server_id; // owning pointer
897 (*session)->InitializeSession(server_id, &crypto_config_, 901 (*session)->InitializeSession(server_id, &crypto_config_,
898 quic_crypto_client_stream_factory_); 902 quic_crypto_client_stream_factory_);
899 bool closed_during_initialize = !ContainsKey(all_sessions_, *session); 903 bool closed_during_initialize =
904 !ContainsKey(all_sessions_, *session) ||
905 !(*session)->connection()->connected();
900 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", 906 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession",
901 closed_during_initialize); 907 closed_during_initialize);
902 if (closed_during_initialize) { 908 if (closed_during_initialize) {
903 DLOG(DFATAL) << "Session closed during initialize"; 909 DLOG(DFATAL) << "Session closed during initialize";
904 *session = NULL; 910 *session = NULL;
905 return ERR_CONNECTION_CLOSED; 911 return ERR_CONNECTION_CLOSED;
906 } 912 }
907 return OK; 913 return OK;
908 } 914 }
909 915
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 http_server_properties_->ClearAlternateProtocol(server); 1003 http_server_properties_->ClearAlternateProtocol(server);
998 http_server_properties_->SetAlternateProtocol( 1004 http_server_properties_->SetAlternateProtocol(
999 server, alternate.port, alternate.protocol, 1); 1005 server, alternate.port, alternate.protocol, 1);
1000 DCHECK_EQ(QUIC, 1006 DCHECK_EQ(QUIC,
1001 http_server_properties_->GetAlternateProtocol(server).protocol); 1007 http_server_properties_->GetAlternateProtocol(server).protocol);
1002 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( 1008 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
1003 server)); 1009 server));
1004 } 1010 }
1005 1011
1006 } // namespace net 1012 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698