Commit 1f5bf270 authored by Nick Harper's avatar Nick Harper Committed by Commit Bot

Plumb netlog reason into SpdySessionPool::CloseCurrentIdleSessions

Change-Id: I432f63e305fdf9e9d6ad5303ddb1cbe41752934b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505940
Auto-Submit: Nick Harper <nharper@chromium.org>
Commit-Queue: Pavol Marko <pmarko@chromium.org>
Reviewed-by: default avatarPavol Marko <pmarko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822110}
parent 67844c90
......@@ -344,7 +344,7 @@ void HttpNetworkSession::CloseAllConnections(int net_error,
void HttpNetworkSession::CloseIdleConnections(const char* net_log_reason_utf8) {
normal_socket_pool_manager_->CloseIdleSockets(net_log_reason_utf8);
websocket_socket_pool_manager_->CloseIdleSockets(net_log_reason_utf8);
spdy_session_pool_.CloseCurrentIdleSessions();
spdy_session_pool_.CloseCurrentIdleSessions(net_log_reason_utf8);
}
void HttpNetworkSession::SetServerPushDelegate(
......
......@@ -419,9 +419,8 @@ void SpdySessionPool::CloseCurrentSessions(Error error) {
false /* idle_only */);
}
void SpdySessionPool::CloseCurrentIdleSessions() {
CloseCurrentSessionsHelper(ERR_ABORTED, "Closing idle sessions.",
true /* idle_only */);
void SpdySessionPool::CloseCurrentIdleSessions(const std::string& description) {
CloseCurrentSessionsHelper(ERR_ABORTED, description, true /* idle_only */);
}
void SpdySessionPool::CloseAllSessions() {
......
......@@ -264,7 +264,7 @@ class NET_EXPORT SpdySessionPool
// Close only the currently existing SpdySessions that are idle.
// Let any new ones created while this method is running continue to
// live.
void CloseCurrentIdleSessions();
void CloseCurrentIdleSessions(const std::string& description);
// Repeatedly close all SpdySessions until all of them (including new ones
// created in the process of closing the current ones, and new ones created in
......
......@@ -250,6 +250,7 @@ TEST_F(SpdySessionPoolTest, CloseCurrentSessions) {
}
TEST_F(SpdySessionPoolTest, CloseCurrentIdleSessions) {
const std::string close_session_description = "Closing idle sessions.";
MockConnect connect_data(SYNCHRONOUS, OK);
MockRead reads[] = {
MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever.
......@@ -318,7 +319,7 @@ TEST_F(SpdySessionPoolTest, CloseCurrentIdleSessions) {
EXPECT_TRUE(session3->IsAvailable());
// Should not do anything, all are active
spdy_session_pool_->CloseCurrentIdleSessions();
spdy_session_pool_->CloseCurrentIdleSessions(close_session_description);
EXPECT_TRUE(session1->is_active());
EXPECT_TRUE(session1->IsAvailable());
EXPECT_TRUE(session2->is_active());
......@@ -340,7 +341,7 @@ TEST_F(SpdySessionPoolTest, CloseCurrentIdleSessions) {
EXPECT_TRUE(session3->IsAvailable());
// Should close session 1 and 3, 2 should be left open
spdy_session_pool_->CloseCurrentIdleSessions();
spdy_session_pool_->CloseCurrentIdleSessions(close_session_description);
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(session1);
......@@ -349,7 +350,7 @@ TEST_F(SpdySessionPoolTest, CloseCurrentIdleSessions) {
EXPECT_FALSE(session3);
// Should not do anything
spdy_session_pool_->CloseCurrentIdleSessions();
spdy_session_pool_->CloseCurrentIdleSessions(close_session_description);
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(session2->is_active());
......@@ -364,7 +365,7 @@ TEST_F(SpdySessionPoolTest, CloseCurrentIdleSessions) {
EXPECT_TRUE(session2->IsAvailable());
// This should close session 2
spdy_session_pool_->CloseCurrentIdleSessions();
spdy_session_pool_->CloseCurrentIdleSessions(close_session_description);
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(session2);
......@@ -582,7 +583,7 @@ void SpdySessionPoolTest::RunIPPoolingTest(
// Test that calling CloseIdleSessions, does not cause a crash.
// http://crbug.com/181400
spdy_session_pool_->CloseCurrentIdleSessions();
spdy_session_pool_->CloseCurrentIdleSessions("Closing idle sessions.");
base::RunLoop().RunUntilIdle();
// Verify spdy_session and spdy_session1 are closed.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment