Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / net / spdy / spdy_session_pool.cc
index 831e09d..10bd52f 100644 (file)
@@ -278,7 +278,24 @@ base::Value* SpdySessionPool::SpdySessionPoolInfoToValue() const {
 }
 
 void SpdySessionPool::OnIPAddressChanged() {
-  CloseCurrentSessions(ERR_NETWORK_CHANGED);
+  WeakSessionList current_sessions = GetCurrentSessions();
+  for (WeakSessionList::const_iterator it = current_sessions.begin();
+       it != current_sessions.end(); ++it) {
+    if (!*it)
+      continue;
+
+    // For OSs that terminate TCP connections upon relevant network changes
+    // there is no need to explicitly close SpdySessions, instead simply mark
+    // the sessions as deprecated so they aren't reused.
+#if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
+    (*it)->MakeUnavailable();
+#else
+    (*it)->CloseSessionOnError(ERR_NETWORK_CHANGED,
+                               "Closing current sessions.");
+    DCHECK(!*it);
+#endif  // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
+    DCHECK(!IsSessionAvailable(*it));
+  }
   http_server_properties_->ClearAllSpdySettings();
 }
 
@@ -287,7 +304,7 @@ void SpdySessionPool::OnSSLConfigChanged() {
 }
 
 void SpdySessionPool::OnCertAdded(const X509Certificate* cert) {
-  CloseCurrentSessions(ERR_NETWORK_CHANGED);
+  CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED);
 }
 
 void SpdySessionPool::OnCACertChanged(const X509Certificate* cert) {
@@ -295,7 +312,7 @@ void SpdySessionPool::OnCACertChanged(const X509Certificate* cert) {
   // reduced. CloseCurrentSessions now because OnCACertChanged does not
   // tell us this.
   // See comments in ClientSocketPoolManager::OnCACertChanged.
-  CloseCurrentSessions(ERR_NETWORK_CHANGED);
+  CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED);
 }
 
 bool SpdySessionPool::IsSessionAvailable(