diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-04 01:41:59 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-04 01:41:59 +0000 |
commit | 7abf7d23f2e0b7ba4a68266ca1dabb919e243558 (patch) | |
tree | b89f6c544e53149570bb44b25600c7851d8a7021 /net/spdy | |
parent | ae7d85482dd44ffd2061fd6dc692f4d1ef769d18 (diff) | |
download | chromium_src-7abf7d23f2e0b7ba4a68266ca1dabb919e243558.zip chromium_src-7abf7d23f2e0b7ba4a68266ca1dabb919e243558.tar.gz chromium_src-7abf7d23f2e0b7ba4a68266ca1dabb919e243558.tar.bz2 |
Flush SSL pools after SSL config changes.
BUG=46043
TEST=Verify that SSL pools are flushed after user makes SSL change.
Review URL: http://codereview.chromium.org/3274004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58567 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r-- | net/spdy/spdy_session_pool.cc | 11 | ||||
-rw-r--r-- | net/spdy/spdy_session_pool.h | 13 | ||||
-rw-r--r-- | net/spdy/spdy_test_util.h | 6 |
3 files changed, 24 insertions, 6 deletions
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc index 01ad56d..10f54f9 100644 --- a/net/spdy/spdy_session_pool.cc +++ b/net/spdy/spdy_session_pool.cc @@ -14,13 +14,18 @@ static const size_t kMaxSessionsPerDomain = 1; int SpdySessionPool::g_max_sessions_per_domain = kMaxSessionsPerDomain; -SpdySessionPool::SpdySessionPool() { +SpdySessionPool::SpdySessionPool(SSLConfigService* ssl_config_service) + : ssl_config_service_(ssl_config_service) { NetworkChangeNotifier::AddObserver(this); + if (ssl_config_service_) + ssl_config_service_->AddObserver(this); } SpdySessionPool::~SpdySessionPool() { CloseAllSessions(); + if (ssl_config_service_) + ssl_config_service_->RemoveObserver(this); NetworkChangeNotifier::RemoveObserver(this); } @@ -107,6 +112,10 @@ void SpdySessionPool::OnIPAddressChanged() { CloseCurrentSessions(); } +void SpdySessionPool::OnSSLConfigChanged() { + CloseCurrentSessions(); +} + SpdySessionPool::SpdySessionList* SpdySessionPool::AddSessionList( const HostPortProxyPair& host_port_proxy_pair) { diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h index 149deb0..9d8d693 100644 --- a/net/spdy/spdy_session_pool.h +++ b/net/spdy/spdy_session_pool.h @@ -17,6 +17,7 @@ #include "net/base/host_port_pair.h" #include "net/base/net_errors.h" #include "net/base/network_change_notifier.h" +#include "net/base/ssl_config_service.h" #include "net/proxy/proxy_config.h" #include "net/proxy/proxy_server.h" @@ -34,9 +35,10 @@ class SpdySession; // TODO(mbelshe): Make this production ready. class SpdySessionPool : public base::RefCounted<SpdySessionPool>, - public NetworkChangeNotifier::Observer { + public NetworkChangeNotifier::Observer, + public SSLConfigService::Observer { public: - SpdySessionPool(); + explicit SpdySessionPool(SSLConfigService* ssl_config_service); // Either returns an existing SpdySession or creates a new SpdySession for // use. @@ -92,6 +94,11 @@ class SpdySessionPool // or error out due to the IP address change. virtual void OnIPAddressChanged(); + // SSLConfigService::Observer methods: + + // We perform the same flushing as described above when SSL settings change. + virtual void OnSSLConfigChanged(); + private: friend class base::RefCounted<SpdySessionPool>; friend class SpdySessionPoolPeer; // For testing. @@ -117,6 +124,8 @@ class SpdySessionPool static int g_max_sessions_per_domain; + const scoped_refptr<SSLConfigService> ssl_config_service_; + DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); }; diff --git a/net/spdy/spdy_test_util.h b/net/spdy/spdy_test_util.h index 34c1df80..3d7ce0c 100644 --- a/net/spdy/spdy_test_util.h +++ b/net/spdy/spdy_test_util.h @@ -305,7 +305,7 @@ class SpdySessionDependencies { socket_factory(new MockClientSocketFactory), deterministic_socket_factory(new DeterministicMockClientSocketFactory), http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()), - spdy_session_pool(new SpdySessionPool()) { + spdy_session_pool(new SpdySessionPool(NULL)) { // Note: The CancelledTransaction test does cleanup by running all // tasks in the message loop (RunAllPending). Unfortunately, that // doesn't clean up tasks on the host resolver thread; and @@ -323,7 +323,7 @@ class SpdySessionDependencies { socket_factory(new MockClientSocketFactory), deterministic_socket_factory(new DeterministicMockClientSocketFactory), http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()), - spdy_session_pool(new SpdySessionPool()) {} + spdy_session_pool(new SpdySessionPool(NULL)) {} scoped_refptr<MockHostResolverBase> host_resolver; scoped_refptr<ProxyService> proxy_service; @@ -363,7 +363,7 @@ class SpdyURLRequestContext : public URLRequestContext { SpdyURLRequestContext() { host_resolver_ = new MockHostResolver; proxy_service_ = ProxyService::CreateNull(); - spdy_session_pool_ = new SpdySessionPool(); + spdy_session_pool_ = new SpdySessionPool(NULL); ssl_config_service_ = new SSLConfigServiceDefaults; http_auth_handler_factory_ = HttpAuthHandlerFactory::CreateDefault(); http_transaction_factory_ = new net::HttpCache( |