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

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

Issue 2344053003: Fixes crash bug when iterating through sessions in OnNetworkConnected. (Closed)
Patch Set: Created 4 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 | net/quic/chromium/quic_stream_factory_test.cc » ('j') | 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/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <openssl/aead.h> 7 #include <openssl/aead.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <tuple> 10 #include <tuple>
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 void QuicStreamFactory::OnIPAddressChanged() { 1258 void QuicStreamFactory::OnIPAddressChanged() {
1259 status_ = OPEN; 1259 status_ = OPEN;
1260 CloseAllSessions(ERR_NETWORK_CHANGED, QUIC_IP_ADDRESS_CHANGED); 1260 CloseAllSessions(ERR_NETWORK_CHANGED, QUIC_IP_ADDRESS_CHANGED);
1261 set_require_confirmation(true); 1261 set_require_confirmation(true);
1262 } 1262 }
1263 1263
1264 void QuicStreamFactory::OnNetworkConnected(NetworkHandle network) { 1264 void QuicStreamFactory::OnNetworkConnected(NetworkHandle network) {
1265 status_ = OPEN; 1265 status_ = OPEN;
1266 ScopedConnectionMigrationEventLog scoped_event_log(net_log_, 1266 ScopedConnectionMigrationEventLog scoped_event_log(net_log_,
1267 "OnNetworkConnected"); 1267 "OnNetworkConnected");
1268 for (auto session : all_sessions_) { 1268 QuicStreamFactory::SessionIdMap::iterator it = all_sessions_.begin();
1269 session.first->OnNetworkConnected(network, scoped_event_log.net_log()); 1269 // Sessions may be deleted while iterating through the map.
1270 while (it != all_sessions_.end()) {
1271 QuicChromiumClientSession* session = it->first;
1272 ++it;
1273 session->OnNetworkConnected(network, scoped_event_log.net_log());
1270 } 1274 }
1271 } 1275 }
1272 1276
1273 void QuicStreamFactory::OnNetworkMadeDefault(NetworkHandle network) { 1277 void QuicStreamFactory::OnNetworkMadeDefault(NetworkHandle network) {
1274 ScopedConnectionMigrationEventLog scoped_event_log(net_log_, 1278 ScopedConnectionMigrationEventLog scoped_event_log(net_log_,
1275 "OnNetworkMadeDefault"); 1279 "OnNetworkMadeDefault");
1276 DCHECK_NE(NetworkChangeNotifier::kInvalidNetworkHandle, network); 1280 DCHECK_NE(NetworkChangeNotifier::kInvalidNetworkHandle, network);
1277 MaybeMigrateOrCloseSessions(network, /*close_if_cannot_migrate=*/false, 1281 MaybeMigrateOrCloseSessions(network, /*close_if_cannot_migrate=*/false,
1278 scoped_event_log.net_log()); 1282 scoped_event_log.net_log());
1279 set_require_confirmation(true); 1283 set_require_confirmation(true);
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 // Since the session was active, there's no longer an 1870 // Since the session was active, there's no longer an
1867 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1871 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1868 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1872 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1869 // it as recently broken, which means that 0-RTT will be disabled but we'll 1873 // it as recently broken, which means that 0-RTT will be disabled but we'll
1870 // still race. 1874 // still race.
1871 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1875 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1872 alternative_service); 1876 alternative_service);
1873 } 1877 }
1874 1878
1875 } // namespace net 1879 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/chromium/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698