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

Side by Side Diff: net/spdy/spdy_session_pool.cc

Issue 129873010: Deprecate instead of close SPDY sessions upon network change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rework deprecation to be less intrusive and avoid making behavior on certain OSs worse Created 6 years, 11 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 | Annotate | Revision Log
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/spdy/spdy_session_pool.h" 5 #include "net/spdy/spdy_session_pool.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 // host_port_proxy_pair (not an alias). 271 // host_port_proxy_pair (not an alias).
272 const SpdySessionKey& key = it->first; 272 const SpdySessionKey& key = it->first;
273 const SpdySessionKey& session_key = it->second->spdy_session_key(); 273 const SpdySessionKey& session_key = it->second->spdy_session_key();
274 if (key.Equals(session_key)) 274 if (key.Equals(session_key))
275 list->Append(it->second->GetInfoAsValue()); 275 list->Append(it->second->GetInfoAsValue());
276 } 276 }
277 return list; 277 return list;
278 } 278 }
279 279
280 void SpdySessionPool::OnIPAddressChanged() { 280 void SpdySessionPool::OnIPAddressChanged() {
281 CloseCurrentSessions(ERR_NETWORK_CHANGED); 281 WeakSessionList current_sessions = GetCurrentSessions();
282 for (WeakSessionList::const_iterator it = current_sessions.begin();
283 it != current_sessions.end(); ++it) {
284 if (!*it)
285 continue;
286
287 // For OSs that terminate TCP connections upon relevant network changes
288 // there is no need to explicitly close SpdySessions, instead simply mark
289 // the sessions as deprecated so they aren't reused.
290 #if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
291 (*it)->Deprecate();
292 #else
293 (*it)->CloseSessionOnError(ERR_NETWORK_CHANGED,
294 "Closing current sessions.");
295 DCHECK(!*it);
296 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
297 DCHECK(!IsSessionAvailable(*it));
298 }
282 http_server_properties_->ClearAllSpdySettings(); 299 http_server_properties_->ClearAllSpdySettings();
283 } 300 }
284 301
285 void SpdySessionPool::OnSSLConfigChanged() { 302 void SpdySessionPool::OnSSLConfigChanged() {
286 CloseCurrentSessions(ERR_NETWORK_CHANGED); 303 CloseCurrentSessions(ERR_NETWORK_CHANGED);
287 } 304 }
288 305
289 void SpdySessionPool::OnCertAdded(const X509Certificate* cert) { 306 void SpdySessionPool::OnCertAdded(const X509Certificate* cert) {
290 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED); 307 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED);
291 } 308 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 if (idle_only && (*it)->is_active()) 399 if (idle_only && (*it)->is_active())
383 continue; 400 continue;
384 401
385 (*it)->CloseSessionOnError(error, description); 402 (*it)->CloseSessionOnError(error, description);
386 DCHECK(!IsSessionAvailable(*it)); 403 DCHECK(!IsSessionAvailable(*it));
387 DCHECK(!*it); 404 DCHECK(!*it);
388 } 405 }
389 } 406 }
390 407
391 } // namespace net 408 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698