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 return list; | 271 return list; |
272 } | 272 } |
273 | 273 |
274 void SpdySessionPool::OnIPAddressChanged() { | 274 void SpdySessionPool::OnIPAddressChanged() { |
275 WeakSessionList current_sessions = GetCurrentSessions(); | 275 WeakSessionList current_sessions = GetCurrentSessions(); |
276 for (WeakSessionList::const_iterator it = current_sessions.begin(); | 276 for (WeakSessionList::const_iterator it = current_sessions.begin(); |
277 it != current_sessions.end(); ++it) { | 277 it != current_sessions.end(); ++it) { |
278 if (!*it) | 278 if (!*it) |
279 continue; | 279 continue; |
280 | 280 |
281 // For OSs that terminate TCP connections upon relevant network changes | 281 // For OSs that terminate TCP connections upon relevant network changes, |
282 // there is no need to explicitly close SpdySessions, instead simply mark | 282 // attempt to preserve active streams by marking all sessions as going |
283 // the sessions as deprecated so they aren't reused. | 283 // away, rather than explicitly closing them. Streams may still fail due |
| 284 // to a generated TCP reset. |
284 #if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) | 285 #if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
285 (*it)->MakeUnavailable(); | 286 (*it)->MakeUnavailable(); |
| 287 (*it)->StartGoingAway(kLastStreamId, OK); |
| 288 (*it)->MaybeFinishGoingAway(); |
286 #else | 289 #else |
287 (*it)->CloseSessionOnError(ERR_NETWORK_CHANGED, | 290 (*it)->CloseSessionOnError(ERR_NETWORK_CHANGED, |
288 "Closing current sessions."); | 291 "Closing current sessions."); |
289 DCHECK((*it)->IsDraining()); | 292 DCHECK((*it)->IsDraining()); |
290 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) | 293 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
291 DCHECK(!IsSessionAvailable(*it)); | 294 DCHECK(!IsSessionAvailable(*it)); |
292 } | 295 } |
293 http_server_properties_->ClearAllSpdySettings(); | 296 http_server_properties_->ClearAllSpdySettings(); |
294 } | 297 } |
295 | 298 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 395 |
393 if (idle_only && (*it)->is_active()) | 396 if (idle_only && (*it)->is_active()) |
394 continue; | 397 continue; |
395 | 398 |
396 (*it)->CloseSessionOnError(error, description); | 399 (*it)->CloseSessionOnError(error, description); |
397 DCHECK(!IsSessionAvailable(*it)); | 400 DCHECK(!IsSessionAvailable(*it)); |
398 } | 401 } |
399 } | 402 } |
400 | 403 |
401 } // namespace net | 404 } // namespace net |
OLD | NEW |