Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: net/spdy/spdy_session.cc

Issue 8330002: Changes the sending of PING to 1 secs instead (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 5 #include "net/spdy/spdy_session.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/linked_ptr.h" 9 #include "base/memory/linked_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // static 230 // static
231 size_t SpdySession::max_concurrent_stream_limit_ = 256; 231 size_t SpdySession::max_concurrent_stream_limit_ = 256;
232 232
233 // static 233 // static
234 bool SpdySession::enable_ping_based_connection_checking_ = true; 234 bool SpdySession::enable_ping_based_connection_checking_ = true;
235 235
236 // static 236 // static
237 int SpdySession::connection_at_risk_of_loss_ms_ = 0; 237 int SpdySession::connection_at_risk_of_loss_ms_ = 0;
238 238
239 // static 239 // static
240 int SpdySession::trailing_ping_delay_time_ms_ = 200; 240 int SpdySession::trailing_ping_delay_time_ms_ = 1000;
241 241
242 // static 242 // static
243 int SpdySession::hung_interval_ms_ = 10000; 243 int SpdySession::hung_interval_ms_ = 10000;
244 244
245 SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, 245 SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair,
246 SpdySessionPool* spdy_session_pool, 246 SpdySessionPool* spdy_session_pool,
247 SpdySettingsStorage* spdy_settings, 247 SpdySettingsStorage* spdy_settings,
248 bool verify_domain_authentication, 248 bool verify_domain_authentication,
249 NetLog* net_log) 249 NetLog* net_log)
250 : ALLOW_THIS_IN_INITIALIZER_LIST( 250 : ALLOW_THIS_IN_INITIALIZER_LIST(
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 base::StatsCounter spdy_requests("spdy.requests"); 521 base::StatsCounter spdy_requests("spdy.requests");
522 spdy_requests.Increment(); 522 spdy_requests.Increment();
523 streams_initiated_count_++; 523 streams_initiated_count_++;
524 524
525 if (net_log().IsLoggingAllEvents()) { 525 if (net_log().IsLoggingAllEvents()) {
526 net_log().AddEvent( 526 net_log().AddEvent(
527 NetLog::TYPE_SPDY_SESSION_SYN_STREAM, 527 NetLog::TYPE_SPDY_SESSION_SYN_STREAM,
528 make_scoped_refptr( 528 make_scoped_refptr(
529 new NetLogSpdySynParameter(headers, flags, stream_id, 0))); 529 new NetLogSpdySynParameter(headers, flags, stream_id, 0)));
530 } 530 }
531
532 // Some servers don't like too many pings, so we limit our current sending to
533 // no more than one ping for any syn sent. To do this, we avoid ever setting
534 // this to true unless we send a syn (which we have just done). This approach
535 // may change over time as servers change their responses to pings.
531 need_to_send_ping_ = true; 536 need_to_send_ping_ = true;
532 537
533 return ERR_IO_PENDING; 538 return ERR_IO_PENDING;
534 } 539 }
535 540
536 int SpdySession::WriteStreamData(spdy::SpdyStreamId stream_id, 541 int SpdySession::WriteStreamData(spdy::SpdyStreamId stream_id,
537 net::IOBuffer* data, int len, 542 net::IOBuffer* data, int len,
538 spdy::SpdyDataFlags flags) { 543 spdy::SpdyDataFlags flags) {
539 // Find our stream 544 // Find our stream
540 DCHECK(IsStreamActive(stream_id)); 545 DCHECK(IsStreamActive(stream_id));
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 1540
1536 base::TimeTicks now = base::TimeTicks::Now(); 1541 base::TimeTicks now = base::TimeTicks::Now();
1537 // If we haven't heard from server, then send a preface-PING. 1542 // If we haven't heard from server, then send a preface-PING.
1538 if ((now - received_data_time_) > kConnectionAtRiskOfLoss) 1543 if ((now - received_data_time_) > kConnectionAtRiskOfLoss)
1539 SendPrefacePing(); 1544 SendPrefacePing();
1540 1545
1541 PlanToSendTrailingPing(); 1546 PlanToSendTrailingPing();
1542 } 1547 }
1543 1548
1544 void SpdySession::SendPrefacePing() { 1549 void SpdySession::SendPrefacePing() {
1545 // TODO(rtenneti): Enable sending Preface-PING after server fix. 1550 // TODO(rtenneti): Send preface pings when more servers support additional
1551 // pings.
1546 // WritePingFrame(next_ping_id_); 1552 // WritePingFrame(next_ping_id_);
1547 } 1553 }
1548 1554
1549 void SpdySession::PlanToSendTrailingPing() { 1555 void SpdySession::PlanToSendTrailingPing() {
1550 if (trailing_ping_pending_) 1556 if (trailing_ping_pending_)
1551 return; 1557 return;
1552 1558
1553 trailing_ping_pending_ = true; 1559 trailing_ping_pending_ = true;
1554 MessageLoop::current()->PostDelayedTask( 1560 MessageLoop::current()->PostDelayedTask(
1555 FROM_HERE, 1561 FROM_HERE,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 if (it == pending_callback_map_.end()) 1707 if (it == pending_callback_map_.end())
1702 return; 1708 return;
1703 1709
1704 OldCompletionCallback* callback = it->second.callback; 1710 OldCompletionCallback* callback = it->second.callback;
1705 int result = it->second.result; 1711 int result = it->second.result;
1706 pending_callback_map_.erase(it); 1712 pending_callback_map_.erase(it);
1707 callback->Run(result); 1713 callback->Run(result);
1708 } 1714 }
1709 1715
1710 } // namespace net 1716 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698