Chromium Code Reviews| 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.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <map> | |
| 8 | |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 10 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 11 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 12 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
| 13 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 14 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
| 15 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 16 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 17 #include "base/time.h" | 19 #include "base/time.h" |
| 18 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 19 #include "base/values.h" | 21 #include "base/values.h" |
| 20 #include "crypto/ec_private_key.h" | 22 #include "crypto/ec_private_key.h" |
| 21 #include "crypto/ec_signature_creator.h" | 23 #include "crypto/ec_signature_creator.h" |
| 22 #include "crypto/signature_creator.h" | 24 #include "crypto/signature_creator.h" |
| 23 #include "net/base/asn1_util.h" | 25 #include "net/base/asn1_util.h" |
| 24 #include "net/base/connection_type_histograms.h" | 26 #include "net/base/connection_type_histograms.h" |
| 25 #include "net/base/net_log.h" | 27 #include "net/base/net_log.h" |
| 26 #include "net/base/net_util.h" | 28 #include "net/base/net_util.h" |
| 27 #include "net/base/origin_bound_cert_service.h" | 29 #include "net/base/origin_bound_cert_service.h" |
| 28 #include "net/http/http_network_session.h" | 30 #include "net/http/http_network_session.h" |
| 29 #include "net/http/http_server_properties.h" | 31 #include "net/http/http_server_properties.h" |
| 30 #include "net/socket/ssl_client_socket.h" | |
| 31 #include "net/spdy/spdy_frame_builder.h" | 32 #include "net/spdy/spdy_frame_builder.h" |
| 32 #include "net/spdy/spdy_http_utils.h" | 33 #include "net/spdy/spdy_http_utils.h" |
| 33 #include "net/spdy/spdy_protocol.h" | 34 #include "net/spdy/spdy_protocol.h" |
| 34 #include "net/spdy/spdy_session_pool.h" | 35 #include "net/spdy/spdy_session_pool.h" |
| 35 #include "net/spdy/spdy_settings_storage.h" | 36 #include "net/spdy/spdy_settings_storage.h" |
| 36 #include "net/spdy/spdy_stream.h" | 37 #include "net/spdy/spdy_stream.h" |
| 37 | 38 |
| 38 namespace net { | 39 namespace net { |
| 39 | 40 |
| 40 NetLogSpdySynParameter::NetLogSpdySynParameter( | 41 NetLogSpdySynParameter::NetLogSpdySynParameter( |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 | 261 |
| 261 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyGoAwayParameter); | 262 DISALLOW_COPY_AND_ASSIGN(NetLogSpdyGoAwayParameter); |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 } // namespace | 265 } // namespace |
| 265 | 266 |
| 266 // static | 267 // static |
| 267 bool SpdySession::use_ssl_ = true; | 268 bool SpdySession::use_ssl_ = true; |
| 268 | 269 |
| 269 // static | 270 // static |
| 270 SpdySession::FlowControl SpdySession::use_flow_control_ = | 271 SpdySession::FlowControl SpdySession::use_flow_control_ = |
|
Ryan Hamilton
2012/03/09 19:09:58
As we discussed yesterday, please remove this vari
ramant (doing other things)
2012/03/10 01:14:09
As we had discussed, will do that in a separate CL
| |
| 271 SpdySession::kFlowControlBasedOnNPN; | 272 SpdySession::kFlowControlBasedOnNPN; |
| 272 | 273 |
| 274 SSLClientSocket::NextProto SpdySession::default_protocol_ = | |
| 275 SSLClientSocket::kProtoSPDY2; | |
|
Ryan Hamilton
2012/03/09 19:09:58
I think that the default value should be set to kP
ramant (doing other things)
2012/03/10 01:14:09
Will work with you to make this change flow_contro
ramant (doing other things)
2012/03/10 02:26:20
Made the change to use kProtoUnknown.
Done.
| |
| 276 | |
| 273 // static | 277 // static |
| 274 size_t SpdySession::init_max_concurrent_streams_ = 10; | 278 size_t SpdySession::init_max_concurrent_streams_ = 10; |
| 275 | 279 |
| 276 // static | 280 // static |
| 277 size_t SpdySession::max_concurrent_stream_limit_ = 256; | 281 size_t SpdySession::max_concurrent_stream_limit_ = 256; |
| 278 | 282 |
| 279 // static | 283 // static |
| 280 bool SpdySession::enable_ping_based_connection_checking_ = true; | 284 bool SpdySession::enable_ping_based_connection_checking_ = true; |
| 281 | 285 |
| 282 // static | 286 // static |
| 283 int SpdySession::connection_at_risk_of_loss_seconds_ = 10; | 287 int SpdySession::connection_at_risk_of_loss_seconds_ = 10; |
| 284 | 288 |
| 285 // static | 289 // static |
| 286 int SpdySession::trailing_ping_delay_time_ms_ = 1000; // 1 second | 290 int SpdySession::trailing_ping_delay_time_ms_ = 1000; // 1 second |
| 287 | 291 |
| 288 // static | 292 // static |
| 289 int SpdySession::hung_interval_ms_ = 10000; // 10 seconds | 293 int SpdySession::hung_interval_ms_ = 10000; // 10 seconds |
| 290 | 294 |
| 295 // static | |
| 296 void SpdySession::ResetStaticSettingsToInit() { | |
| 297 // WARNING: These must match the initializers above. | |
| 298 use_flow_control_ = SpdySession::kFlowControlBasedOnNPN; | |
| 299 default_protocol_ = SSLClientSocket::kProtoSPDY2; | |
| 300 } | |
| 301 | |
| 291 SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, | 302 SpdySession::SpdySession(const HostPortProxyPair& host_port_proxy_pair, |
| 292 SpdySessionPool* spdy_session_pool, | 303 SpdySessionPool* spdy_session_pool, |
| 293 HttpServerProperties* http_server_properties, | 304 HttpServerProperties* http_server_properties, |
| 294 bool verify_domain_authentication, | 305 bool verify_domain_authentication, |
| 295 NetLog* net_log) | 306 NetLog* net_log) |
| 296 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 307 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 297 host_port_proxy_pair_(host_port_proxy_pair), | 308 host_port_proxy_pair_(host_port_proxy_pair), |
| 298 spdy_session_pool_(spdy_session_pool), | 309 spdy_session_pool_(spdy_session_pool), |
| 299 http_server_properties_(http_server_properties), | 310 http_server_properties_(http_server_properties), |
| 300 connection_(new ClientSocketHandle), | 311 connection_(new ClientSocketHandle), |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 bool is_secure, | 385 bool is_secure, |
| 375 int certificate_error_code) { | 386 int certificate_error_code) { |
| 376 base::StatsCounter spdy_sessions("spdy.sessions"); | 387 base::StatsCounter spdy_sessions("spdy.sessions"); |
| 377 spdy_sessions.Increment(); | 388 spdy_sessions.Increment(); |
| 378 | 389 |
| 379 state_ = CONNECTED; | 390 state_ = CONNECTED; |
| 380 connection_.reset(connection); | 391 connection_.reset(connection); |
| 381 is_secure_ = is_secure; | 392 is_secure_ = is_secure; |
| 382 certificate_error_code_ = certificate_error_code; | 393 certificate_error_code_ = certificate_error_code; |
| 383 | 394 |
| 395 SSLClientSocket::NextProto protocol = default_protocol_; | |
| 384 if (is_secure_) { | 396 if (is_secure_) { |
| 385 SSLClientSocket* ssl_socket = GetSSLClientSocket(); | 397 SSLClientSocket* ssl_socket = GetSSLClientSocket(); |
| 386 | 398 |
| 387 SSLClientSocket::NextProto protocol_negotiated = | 399 SSLClientSocket::NextProto protocol_negotiated = |
| 388 ssl_socket->protocol_negotiated(); | 400 ssl_socket->protocol_negotiated(); |
| 389 if (protocol_negotiated != SSLClientSocket::kProtoUnknown) | 401 if (protocol_negotiated != SSLClientSocket::kProtoUnknown) { |
| 402 protocol = protocol_negotiated; | |
| 390 flow_control_ = (protocol_negotiated >= SSLClientSocket::kProtoSPDY21); | 403 flow_control_ = (protocol_negotiated >= SSLClientSocket::kProtoSPDY21); |
| 404 } | |
| 391 | 405 |
| 392 if (ssl_socket->WasOriginBoundCertSent()) { | 406 if (ssl_socket->WasOriginBoundCertSent()) { |
| 393 // According to the SPDY spec, the credential associated with the TLS | 407 // According to the SPDY spec, the credential associated with the TLS |
| 394 // connection is stored in slot[0]. | 408 // connection is stored in slot[0]. |
| 395 credential_state_.SetHasCredential(host_port_pair()); | 409 credential_state_.SetHasCredential(host_port_pair()); |
| 396 } | 410 } |
| 397 } | 411 } |
| 398 | 412 |
| 399 buffered_spdy_framer_.reset(new spdy::BufferedSpdyFramer(2)); | 413 int version = 2; |
| 414 switch (protocol) { | |
| 415 case SSLClientSocket::kProtoSPDY2: | |
| 416 case SSLClientSocket::kProtoSPDY21: | |
| 417 version = 2; | |
| 418 break; | |
| 419 case SSLClientSocket::kProtoSPDY3: | |
| 420 version = 3; | |
| 421 break; | |
| 422 default: | |
| 423 NOTREACHED(); | |
| 424 } | |
| 425 | |
| 426 buffered_spdy_framer_.reset(new spdy::BufferedSpdyFramer(version)); | |
| 400 buffered_spdy_framer_->set_visitor(this); | 427 buffered_spdy_framer_->set_visitor(this); |
| 401 SendSettings(); | 428 SendSettings(); |
| 402 | 429 |
| 403 // Write out any data that we might have to send, such as the settings frame. | 430 // Write out any data that we might have to send, such as the settings frame. |
| 404 WriteSocketLater(); | 431 WriteSocketLater(); |
| 405 net::Error error = ReadSocket(); | 432 net::Error error = ReadSocket(); |
| 406 if (error == ERR_IO_PENDING) | 433 if (error == ERR_IO_PENDING) |
| 407 return OK; | 434 return OK; |
| 408 return error; | 435 return error; |
| 409 } | 436 } |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1267 | 1294 |
| 1268 if (!IsStreamActive(stream_id)) { | 1295 if (!IsStreamActive(stream_id)) { |
| 1269 // NOTE: it may just be that the stream was cancelled. | 1296 // NOTE: it may just be that the stream was cancelled. |
| 1270 return; | 1297 return; |
| 1271 } | 1298 } |
| 1272 | 1299 |
| 1273 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; | 1300 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; |
| 1274 stream->OnDataReceived(data, len); | 1301 stream->OnDataReceived(data, len); |
| 1275 } | 1302 } |
| 1276 | 1303 |
| 1304 void SpdySession::OnSetting(spdy::SpdySettingsIds id, | |
| 1305 uint8 flags, | |
| 1306 uint32 value) { | |
| 1307 HandleSetting(id, value); | |
| 1308 spdy::SettingsFlagsAndId flags_and_id(flags, id); | |
| 1309 http_server_properties_->SetSpdySetting( | |
| 1310 host_port_pair(), std::make_pair(flags_and_id, value)); | |
| 1311 | |
| 1312 received_settings_ = true; | |
| 1313 | |
| 1314 // Log the settings. | |
| 1315 spdy::SpdySettings settings; | |
| 1316 settings.insert(settings.end(), std::make_pair(flags_and_id, value)); | |
| 1317 net_log_.AddEvent( | |
| 1318 NetLog::TYPE_SPDY_SESSION_RECV_SETTINGS, | |
| 1319 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); | |
| 1320 } | |
| 1321 | |
| 1277 bool SpdySession::Respond(const spdy::SpdyHeaderBlock& headers, | 1322 bool SpdySession::Respond(const spdy::SpdyHeaderBlock& headers, |
| 1278 const scoped_refptr<SpdyStream> stream) { | 1323 const scoped_refptr<SpdyStream> stream) { |
| 1279 int rv = OK; | 1324 int rv = OK; |
| 1280 rv = stream->OnResponseReceived(headers); | 1325 rv = stream->OnResponseReceived(headers); |
| 1281 if (rv < 0) { | 1326 if (rv < 0) { |
| 1282 DCHECK_NE(rv, ERR_IO_PENDING); | 1327 DCHECK_NE(rv, ERR_IO_PENDING); |
| 1283 const spdy::SpdyStreamId stream_id = stream->stream_id(); | 1328 const spdy::SpdyStreamId stream_id = stream->stream_id(); |
| 1284 DeleteStream(stream_id, rv); | 1329 DeleteStream(stream_id, rv); |
| 1285 return false; | 1330 return false; |
| 1286 } | 1331 } |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1528 // We will record RTT in histogram when there are no more client sent | 1573 // We will record RTT in histogram when there are no more client sent |
| 1529 // pings_in_flight_. | 1574 // pings_in_flight_. |
| 1530 RecordPingRTTHistogram(base::TimeTicks::Now() - last_ping_sent_time_); | 1575 RecordPingRTTHistogram(base::TimeTicks::Now() - last_ping_sent_time_); |
| 1531 | 1576 |
| 1532 if (!need_to_send_ping_) | 1577 if (!need_to_send_ping_) |
| 1533 return; | 1578 return; |
| 1534 | 1579 |
| 1535 PlanToSendTrailingPing(); | 1580 PlanToSendTrailingPing(); |
| 1536 } | 1581 } |
| 1537 | 1582 |
| 1538 void SpdySession::OnSettings(const spdy::SpdySettingsControlFrame& frame) { | |
| 1539 spdy::SpdySettings settings; | |
| 1540 if (spdy::SpdyFramer::ParseSettings(&frame, &settings)) { | |
| 1541 HandleSettings(settings); | |
| 1542 http_server_properties_->SetSpdySettings(host_port_pair(), settings); | |
| 1543 } | |
| 1544 | |
| 1545 received_settings_ = true; | |
| 1546 | |
| 1547 net_log_.AddEvent( | |
| 1548 NetLog::TYPE_SPDY_SESSION_RECV_SETTINGS, | |
| 1549 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); | |
| 1550 } | |
| 1551 | |
| 1552 void SpdySession::OnWindowUpdate( | 1583 void SpdySession::OnWindowUpdate( |
| 1553 const spdy::SpdyWindowUpdateControlFrame& frame) { | 1584 const spdy::SpdyWindowUpdateControlFrame& frame) { |
| 1554 spdy::SpdyStreamId stream_id = frame.stream_id(); | 1585 spdy::SpdyStreamId stream_id = frame.stream_id(); |
| 1555 int32 delta_window_size = static_cast<int32>(frame.delta_window_size()); | 1586 int32 delta_window_size = static_cast<int32>(frame.delta_window_size()); |
| 1556 net_log_.AddEvent( | 1587 net_log_.AddEvent( |
| 1557 NetLog::TYPE_SPDY_SESSION_RECEIVED_WINDOW_UPDATE, | 1588 NetLog::TYPE_SPDY_SESSION_RECEIVED_WINDOW_UPDATE, |
| 1558 make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( | 1589 make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( |
| 1559 stream_id, delta_window_size))); | 1590 stream_id, delta_window_size))); |
| 1560 | 1591 |
| 1561 if (!IsStreamActive(stream_id)) { | 1592 if (!IsStreamActive(stream_id)) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1620 | 1651 |
| 1621 void SpdySession::SendSettings() { | 1652 void SpdySession::SendSettings() { |
| 1622 // Note: we're copying the settings here, so that we can potentially modify | 1653 // Note: we're copying the settings here, so that we can potentially modify |
| 1623 // the settings for the field trial. When removing the field trial, make | 1654 // the settings for the field trial. When removing the field trial, make |
| 1624 // this a reference to the const SpdySettings again. | 1655 // this a reference to the const SpdySettings again. |
| 1625 spdy::SpdySettings settings = | 1656 spdy::SpdySettings settings = |
| 1626 http_server_properties_->GetSpdySettings(host_port_pair()); | 1657 http_server_properties_->GetSpdySettings(host_port_pair()); |
| 1627 if (settings.empty()) | 1658 if (settings.empty()) |
| 1628 return; | 1659 return; |
| 1629 | 1660 |
| 1661 typedef std::map<uint64, spdy::SpdySetting> SpdySettingsMap; | |
| 1662 SpdySettingsMap unique_settings; | |
| 1663 | |
| 1630 // Record Histogram Data and Apply the SpdyCwnd FieldTrial if applicable. | 1664 // Record Histogram Data and Apply the SpdyCwnd FieldTrial if applicable. |
| 1631 for (spdy::SpdySettings::iterator i = settings.begin(), | 1665 for (spdy::SpdySettings::iterator i = settings.begin(), |
| 1632 end = settings.end(); i != end; ++i) { | 1666 end = settings.end(); i != end; ++i) { |
| 1633 const uint32 id = i->first.id(); | 1667 const uint32 id = i->first.id(); |
| 1634 const uint32 val = i->second; | 1668 const uint32 val = i->second; |
| 1669 int64 key = i->first.flags(); | |
| 1670 key = key << 32; | |
| 1671 key |= id; | |
| 1635 switch (id) { | 1672 switch (id) { |
| 1636 case spdy::SETTINGS_CURRENT_CWND: | 1673 case spdy::SETTINGS_CURRENT_CWND: |
| 1637 uint32 cwnd = 0; | 1674 uint32 cwnd = 0; |
| 1638 cwnd = ApplyCwndFieldTrialPolicy(val); | 1675 cwnd = ApplyCwndFieldTrialPolicy(val); |
| 1639 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", | 1676 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", |
| 1640 cwnd, | 1677 cwnd, |
| 1641 1, 200, 100); | 1678 1, 200, 100); |
| 1642 if (cwnd != val) { | 1679 if (cwnd != val) { |
| 1680 spdy::SettingsFlagsAndId new_id(spdy::SETTINGS_FLAG_PLEASE_PERSIST, | |
| 1681 id); | |
| 1643 i->second = cwnd; | 1682 i->second = cwnd; |
| 1644 i->first.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | 1683 i->first = new_id; |
| 1645 http_server_properties_->SetSpdySettings(host_port_pair(), settings); | 1684 spdy::SpdySetting setting(new_id, val); |
| 1685 http_server_properties_->SetSpdySetting(host_port_pair(), setting); | |
| 1686 unique_settings[key] = setting; | |
| 1687 continue; | |
| 1646 } | 1688 } |
| 1647 break; | |
| 1648 } | 1689 } |
| 1690 unique_settings[key] = *i; | |
| 1649 } | 1691 } |
| 1650 | 1692 |
| 1651 HandleSettings(settings); | 1693 HandleSettings(settings); |
| 1652 | 1694 |
| 1653 net_log_.AddEvent( | 1695 net_log_.AddEvent( |
| 1654 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, | 1696 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, |
| 1655 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); | 1697 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); |
| 1656 | 1698 |
| 1699 spdy::SpdySettings sorted_settings; | |
| 1700 for (SpdySettingsMap::iterator it = unique_settings.begin(); | |
| 1701 unique_settings.end() != it; | |
| 1702 ++it) { | |
| 1703 sorted_settings.push_back(it->second); | |
| 1704 } | |
| 1705 | |
| 1657 // Create the SETTINGS frame and send it. | 1706 // Create the SETTINGS frame and send it. |
| 1658 DCHECK(buffered_spdy_framer_.get()); | 1707 DCHECK(buffered_spdy_framer_.get()); |
| 1659 scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( | 1708 scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( |
| 1660 buffered_spdy_framer_->CreateSettings(settings)); | 1709 buffered_spdy_framer_->CreateSettings(sorted_settings)); |
| 1661 sent_settings_ = true; | 1710 sent_settings_ = true; |
| 1662 QueueFrame(settings_frame.get(), 0, NULL); | 1711 QueueFrame(settings_frame.get(), 0, NULL); |
| 1663 } | 1712 } |
| 1664 | 1713 |
| 1665 void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { | 1714 void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { |
| 1666 for (spdy::SpdySettings::const_iterator i = settings.begin(), | 1715 for (spdy::SpdySettings::const_iterator i = settings.begin(), |
| 1667 end = settings.end(); i != end; ++i) { | 1716 end = settings.end(); i != end; ++i) { |
| 1668 const uint32 id = i->first.id(); | 1717 HandleSetting(i->first.id(), i->second); |
| 1669 const uint32 val = i->second; | 1718 } |
| 1670 switch (id) { | 1719 } |
| 1671 case spdy::SETTINGS_MAX_CONCURRENT_STREAMS: | 1720 |
| 1672 max_concurrent_streams_ = std::min(static_cast<size_t>(val), | 1721 void SpdySession::HandleSetting(uint32 id, uint32 value) { |
| 1673 max_concurrent_stream_limit_); | 1722 switch (id) { |
| 1674 ProcessPendingCreateStreams(); | 1723 case spdy::SETTINGS_MAX_CONCURRENT_STREAMS: |
| 1675 break; | 1724 max_concurrent_streams_ = std::min(static_cast<size_t>(value), |
| 1676 case spdy::SETTINGS_INITIAL_WINDOW_SIZE: | 1725 max_concurrent_stream_limit_); |
| 1677 // INITIAL_WINDOW_SIZE updates initial_send_window_size_ only. | 1726 ProcessPendingCreateStreams(); |
| 1678 // TODO(rtenneti): discuss with the server team about | 1727 break; |
| 1679 // initial_recv_window_size_. | 1728 case spdy::SETTINGS_INITIAL_WINDOW_SIZE: |
| 1680 int32 prev_initial_send_window_size = initial_send_window_size_; | 1729 // INITIAL_WINDOW_SIZE updates initial_send_window_size_ only. |
| 1681 initial_send_window_size_ = val; | 1730 // TODO(rtenneti): discuss with the server team about |
| 1682 int32 delta_window_size = | 1731 // initial_recv_window_size_. |
| 1683 initial_send_window_size_ - prev_initial_send_window_size; | 1732 int32 prev_initial_send_window_size = initial_send_window_size_; |
| 1684 UpdateStreamsSendWindowSize(delta_window_size); | 1733 initial_send_window_size_ = value; |
| 1685 break; | 1734 int32 delta_window_size = |
| 1686 } | 1735 initial_send_window_size_ - prev_initial_send_window_size; |
| 1736 UpdateStreamsSendWindowSize(delta_window_size); | |
| 1737 break; | |
| 1687 } | 1738 } |
| 1688 } | 1739 } |
| 1689 | 1740 |
| 1690 void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { | 1741 void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { |
| 1691 ActiveStreamMap::iterator it; | 1742 ActiveStreamMap::iterator it; |
| 1692 for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { | 1743 for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { |
| 1693 const scoped_refptr<SpdyStream>& stream = it->second; | 1744 const scoped_refptr<SpdyStream>& stream = it->second; |
| 1694 DCHECK(stream); | 1745 DCHECK(stream); |
| 1695 stream->AdjustSendWindowSize(delta_window_size); | 1746 stream->AdjustSendWindowSize(delta_window_size); |
| 1696 } | 1747 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1729 | 1780 |
| 1730 void SpdySession::SendTrailingPing() { | 1781 void SpdySession::SendTrailingPing() { |
| 1731 DCHECK(trailing_ping_pending_); | 1782 DCHECK(trailing_ping_pending_); |
| 1732 trailing_ping_pending_ = false; | 1783 trailing_ping_pending_ = false; |
| 1733 WritePingFrame(next_ping_id_); | 1784 WritePingFrame(next_ping_id_); |
| 1734 } | 1785 } |
| 1735 | 1786 |
| 1736 void SpdySession::WritePingFrame(uint32 unique_id) { | 1787 void SpdySession::WritePingFrame(uint32 unique_id) { |
| 1737 DCHECK(buffered_spdy_framer_.get()); | 1788 DCHECK(buffered_spdy_framer_.get()); |
| 1738 scoped_ptr<spdy::SpdyPingControlFrame> ping_frame( | 1789 scoped_ptr<spdy::SpdyPingControlFrame> ping_frame( |
| 1739 spdy::SpdyFramer::CreatePingFrame(next_ping_id_)); | 1790 buffered_spdy_framer_->CreatePingFrame(next_ping_id_)); |
| 1740 QueueFrame(ping_frame.get(), SPDY_PRIORITY_HIGHEST, NULL); | 1791 QueueFrame( |
| 1792 ping_frame.get(), buffered_spdy_framer_->GetHighestPriority(), NULL); | |
| 1741 | 1793 |
| 1742 if (net_log().IsLoggingAllEvents()) { | 1794 if (net_log().IsLoggingAllEvents()) { |
| 1743 net_log().AddEvent( | 1795 net_log().AddEvent( |
| 1744 NetLog::TYPE_SPDY_SESSION_PING, | 1796 NetLog::TYPE_SPDY_SESSION_PING, |
| 1745 make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent"))); | 1797 make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent"))); |
| 1746 } | 1798 } |
| 1747 if (unique_id % 2 != 0) { | 1799 if (unique_id % 2 != 0) { |
| 1748 next_ping_id_ += 2; | 1800 next_ping_id_ += 2; |
| 1749 ++pings_in_flight_; | 1801 ++pings_in_flight_; |
| 1750 need_to_send_ping_ = false; | 1802 need_to_send_ping_ = false; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1891 SSLClientSocket* SpdySession::GetSSLClientSocket() const { | 1943 SSLClientSocket* SpdySession::GetSSLClientSocket() const { |
| 1892 if (!is_secure_) | 1944 if (!is_secure_) |
| 1893 return NULL; | 1945 return NULL; |
| 1894 SSLClientSocket* ssl_socket = | 1946 SSLClientSocket* ssl_socket = |
| 1895 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 1947 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
| 1896 DCHECK(ssl_socket); | 1948 DCHECK(ssl_socket); |
| 1897 return ssl_socket; | 1949 return ssl_socket; |
| 1898 } | 1950 } |
| 1899 | 1951 |
| 1900 } // namespace net | 1952 } // namespace net |
| OLD | NEW |