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/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 Loading... | |
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)); | |
akalin
2014/01/27 22:20:03
this should probably go in the #if block, since fr
pauljensen
2014/01/28 19:34:45
That was my thought too, but I wanted to keep in l
akalin
2014/01/28 23:23:27
Nevermind I misread the code -- I thought it was a
| |
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 Loading... | |
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 |
OLD | NEW |