| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_ = |
| 271 SpdySession::kFlowControlBasedOnNPN; | 272 SpdySession::kFlowControlBasedOnNPN; |
| 272 | 273 |
| 274 SSLClientSocket::NextProto SpdySession::default_protocol_ = |
| 275 SSLClientSocket::kProtoUnknown; |
| 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::kProtoUnknown; |
| 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 break; |
| 425 } |
| 426 |
| 427 buffered_spdy_framer_.reset(new spdy::BufferedSpdyFramer(version)); |
| 400 buffered_spdy_framer_->set_visitor(this); | 428 buffered_spdy_framer_->set_visitor(this); |
| 401 SendSettings(); | 429 SendSettings(); |
| 402 | 430 |
| 403 // Write out any data that we might have to send, such as the settings frame. | 431 // Write out any data that we might have to send, such as the settings frame. |
| 404 WriteSocketLater(); | 432 WriteSocketLater(); |
| 405 net::Error error = ReadSocket(); | 433 net::Error error = ReadSocket(); |
| 406 if (error == ERR_IO_PENDING) | 434 if (error == ERR_IO_PENDING) |
| 407 return OK; | 435 return OK; |
| 408 return error; | 436 return error; |
| 409 } | 437 } |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 | 1295 |
| 1268 if (!IsStreamActive(stream_id)) { | 1296 if (!IsStreamActive(stream_id)) { |
| 1269 // NOTE: it may just be that the stream was cancelled. | 1297 // NOTE: it may just be that the stream was cancelled. |
| 1270 return; | 1298 return; |
| 1271 } | 1299 } |
| 1272 | 1300 |
| 1273 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; | 1301 scoped_refptr<SpdyStream> stream = active_streams_[stream_id]; |
| 1274 stream->OnDataReceived(data, len); | 1302 stream->OnDataReceived(data, len); |
| 1275 } | 1303 } |
| 1276 | 1304 |
| 1305 void SpdySession::OnSetting(spdy::SpdySettingsIds id, |
| 1306 uint8 flags, |
| 1307 uint32 value) { |
| 1308 HandleSetting(id, value); |
| 1309 spdy::SettingsFlagsAndId flags_and_id(flags, id); |
| 1310 http_server_properties_->SetSpdySetting( |
| 1311 host_port_pair(), std::make_pair(flags_and_id, value)); |
| 1312 |
| 1313 received_settings_ = true; |
| 1314 |
| 1315 // Log the settings. |
| 1316 spdy::SpdySettings settings; |
| 1317 settings.insert(settings.end(), std::make_pair(flags_and_id, value)); |
| 1318 net_log_.AddEvent( |
| 1319 NetLog::TYPE_SPDY_SESSION_RECV_SETTINGS, |
| 1320 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); |
| 1321 } |
| 1322 |
| 1277 bool SpdySession::Respond(const spdy::SpdyHeaderBlock& headers, | 1323 bool SpdySession::Respond(const spdy::SpdyHeaderBlock& headers, |
| 1278 const scoped_refptr<SpdyStream> stream) { | 1324 const scoped_refptr<SpdyStream> stream) { |
| 1279 int rv = OK; | 1325 int rv = OK; |
| 1280 rv = stream->OnResponseReceived(headers); | 1326 rv = stream->OnResponseReceived(headers); |
| 1281 if (rv < 0) { | 1327 if (rv < 0) { |
| 1282 DCHECK_NE(rv, ERR_IO_PENDING); | 1328 DCHECK_NE(rv, ERR_IO_PENDING); |
| 1283 const spdy::SpdyStreamId stream_id = stream->stream_id(); | 1329 const spdy::SpdyStreamId stream_id = stream->stream_id(); |
| 1284 DeleteStream(stream_id, rv); | 1330 DeleteStream(stream_id, rv); |
| 1285 return false; | 1331 return false; |
| 1286 } | 1332 } |
| (...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 | 1574 // We will record RTT in histogram when there are no more client sent |
| 1529 // pings_in_flight_. | 1575 // pings_in_flight_. |
| 1530 RecordPingRTTHistogram(base::TimeTicks::Now() - last_ping_sent_time_); | 1576 RecordPingRTTHistogram(base::TimeTicks::Now() - last_ping_sent_time_); |
| 1531 | 1577 |
| 1532 if (!need_to_send_ping_) | 1578 if (!need_to_send_ping_) |
| 1533 return; | 1579 return; |
| 1534 | 1580 |
| 1535 PlanToSendTrailingPing(); | 1581 PlanToSendTrailingPing(); |
| 1536 } | 1582 } |
| 1537 | 1583 |
| 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( | 1584 void SpdySession::OnWindowUpdate( |
| 1553 const spdy::SpdyWindowUpdateControlFrame& frame) { | 1585 const spdy::SpdyWindowUpdateControlFrame& frame) { |
| 1554 spdy::SpdyStreamId stream_id = frame.stream_id(); | 1586 spdy::SpdyStreamId stream_id = frame.stream_id(); |
| 1555 int32 delta_window_size = static_cast<int32>(frame.delta_window_size()); | 1587 int32 delta_window_size = static_cast<int32>(frame.delta_window_size()); |
| 1556 net_log_.AddEvent( | 1588 net_log_.AddEvent( |
| 1557 NetLog::TYPE_SPDY_SESSION_RECEIVED_WINDOW_UPDATE, | 1589 NetLog::TYPE_SPDY_SESSION_RECEIVED_WINDOW_UPDATE, |
| 1558 make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( | 1590 make_scoped_refptr(new NetLogSpdyWindowUpdateParameter( |
| 1559 stream_id, delta_window_size))); | 1591 stream_id, delta_window_size))); |
| 1560 | 1592 |
| 1561 if (!IsStreamActive(stream_id)) { | 1593 if (!IsStreamActive(stream_id)) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1620 | 1652 |
| 1621 void SpdySession::SendSettings() { | 1653 void SpdySession::SendSettings() { |
| 1622 // Note: we're copying the settings here, so that we can potentially modify | 1654 // 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 | 1655 // the settings for the field trial. When removing the field trial, make |
| 1624 // this a reference to the const SpdySettings again. | 1656 // this a reference to the const SpdySettings again. |
| 1625 spdy::SpdySettings settings = | 1657 spdy::SpdySettings settings = |
| 1626 http_server_properties_->GetSpdySettings(host_port_pair()); | 1658 http_server_properties_->GetSpdySettings(host_port_pair()); |
| 1627 if (settings.empty()) | 1659 if (settings.empty()) |
| 1628 return; | 1660 return; |
| 1629 | 1661 |
| 1662 typedef std::map<uint32, spdy::SpdySetting> SpdySettingsMap; |
| 1663 SpdySettingsMap unique_settings; |
| 1664 |
| 1630 // Record Histogram Data and Apply the SpdyCwnd FieldTrial if applicable. | 1665 // Record Histogram Data and Apply the SpdyCwnd FieldTrial if applicable. |
| 1631 for (spdy::SpdySettings::iterator i = settings.begin(), | 1666 for (spdy::SpdySettings::iterator i = settings.begin(), |
| 1632 end = settings.end(); i != end; ++i) { | 1667 end = settings.end(); i != end; ++i) { |
| 1633 const uint32 id = i->first.id(); | 1668 const uint32 id = i->first.id(); |
| 1634 const uint32 val = i->second; | 1669 const uint32 val = i->second; |
| 1635 switch (id) { | 1670 switch (id) { |
| 1636 case spdy::SETTINGS_CURRENT_CWND: | 1671 case spdy::SETTINGS_CURRENT_CWND: |
| 1637 uint32 cwnd = 0; | 1672 uint32 cwnd = 0; |
| 1638 cwnd = ApplyCwndFieldTrialPolicy(val); | 1673 cwnd = ApplyCwndFieldTrialPolicy(val); |
| 1639 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", | 1674 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", |
| 1640 cwnd, | 1675 cwnd, |
| 1641 1, 200, 100); | 1676 1, 200, 100); |
| 1642 if (cwnd != val) { | 1677 if (cwnd != val) { |
| 1678 spdy::SettingsFlagsAndId new_id(spdy::SETTINGS_FLAG_PLEASE_PERSIST, |
| 1679 id); |
| 1643 i->second = cwnd; | 1680 i->second = cwnd; |
| 1644 i->first.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | 1681 i->first = new_id; |
| 1645 http_server_properties_->SetSpdySettings(host_port_pair(), settings); | 1682 spdy::SpdySetting setting(new_id, val); |
| 1683 http_server_properties_->SetSpdySetting(host_port_pair(), setting); |
| 1684 unique_settings[id] = setting; |
| 1685 continue; |
| 1646 } | 1686 } |
| 1647 break; | |
| 1648 } | 1687 } |
| 1688 unique_settings[id] = *i; |
| 1649 } | 1689 } |
| 1650 | 1690 |
| 1651 HandleSettings(settings); | 1691 HandleSettings(settings); |
| 1652 | 1692 |
| 1653 net_log_.AddEvent( | 1693 net_log_.AddEvent( |
| 1654 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, | 1694 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, |
| 1655 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); | 1695 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); |
| 1656 | 1696 |
| 1697 spdy::SpdySettings sorted_settings; |
| 1698 for (SpdySettingsMap::iterator it = unique_settings.begin(); |
| 1699 unique_settings.end() != it; |
| 1700 ++it) { |
| 1701 sorted_settings.push_back(it->second); |
| 1702 } |
| 1703 |
| 1657 // Create the SETTINGS frame and send it. | 1704 // Create the SETTINGS frame and send it. |
| 1658 DCHECK(buffered_spdy_framer_.get()); | 1705 DCHECK(buffered_spdy_framer_.get()); |
| 1659 scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( | 1706 scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( |
| 1660 buffered_spdy_framer_->CreateSettings(settings)); | 1707 buffered_spdy_framer_->CreateSettings(sorted_settings)); |
| 1661 sent_settings_ = true; | 1708 sent_settings_ = true; |
| 1662 QueueFrame(settings_frame.get(), 0, NULL); | 1709 QueueFrame(settings_frame.get(), 0, NULL); |
| 1663 } | 1710 } |
| 1664 | 1711 |
| 1665 void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { | 1712 void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { |
| 1666 for (spdy::SpdySettings::const_iterator i = settings.begin(), | 1713 for (spdy::SpdySettings::const_iterator i = settings.begin(), |
| 1667 end = settings.end(); i != end; ++i) { | 1714 end = settings.end(); i != end; ++i) { |
| 1668 const uint32 id = i->first.id(); | 1715 HandleSetting(i->first.id(), i->second); |
| 1669 const uint32 val = i->second; | 1716 } |
| 1670 switch (id) { | 1717 } |
| 1671 case spdy::SETTINGS_MAX_CONCURRENT_STREAMS: | 1718 |
| 1672 max_concurrent_streams_ = std::min(static_cast<size_t>(val), | 1719 void SpdySession::HandleSetting(uint32 id, uint32 value) { |
| 1673 max_concurrent_stream_limit_); | 1720 switch (id) { |
| 1674 ProcessPendingCreateStreams(); | 1721 case spdy::SETTINGS_MAX_CONCURRENT_STREAMS: |
| 1675 break; | 1722 max_concurrent_streams_ = std::min(static_cast<size_t>(value), |
| 1676 case spdy::SETTINGS_INITIAL_WINDOW_SIZE: | 1723 max_concurrent_stream_limit_); |
| 1677 // INITIAL_WINDOW_SIZE updates initial_send_window_size_ only. | 1724 ProcessPendingCreateStreams(); |
| 1678 // TODO(rtenneti): discuss with the server team about | 1725 break; |
| 1679 // initial_recv_window_size_. | 1726 case spdy::SETTINGS_INITIAL_WINDOW_SIZE: |
| 1680 int32 prev_initial_send_window_size = initial_send_window_size_; | 1727 // INITIAL_WINDOW_SIZE updates initial_send_window_size_ only. |
| 1681 initial_send_window_size_ = val; | 1728 // TODO(rtenneti): discuss with the server team about |
| 1682 int32 delta_window_size = | 1729 // initial_recv_window_size_. |
| 1683 initial_send_window_size_ - prev_initial_send_window_size; | 1730 int32 prev_initial_send_window_size = initial_send_window_size_; |
| 1684 UpdateStreamsSendWindowSize(delta_window_size); | 1731 initial_send_window_size_ = value; |
| 1685 break; | 1732 int32 delta_window_size = |
| 1686 } | 1733 initial_send_window_size_ - prev_initial_send_window_size; |
| 1734 UpdateStreamsSendWindowSize(delta_window_size); |
| 1735 break; |
| 1687 } | 1736 } |
| 1688 } | 1737 } |
| 1689 | 1738 |
| 1690 void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { | 1739 void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { |
| 1691 ActiveStreamMap::iterator it; | 1740 ActiveStreamMap::iterator it; |
| 1692 for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { | 1741 for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { |
| 1693 const scoped_refptr<SpdyStream>& stream = it->second; | 1742 const scoped_refptr<SpdyStream>& stream = it->second; |
| 1694 DCHECK(stream); | 1743 DCHECK(stream); |
| 1695 stream->AdjustSendWindowSize(delta_window_size); | 1744 stream->AdjustSendWindowSize(delta_window_size); |
| 1696 } | 1745 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1729 | 1778 |
| 1730 void SpdySession::SendTrailingPing() { | 1779 void SpdySession::SendTrailingPing() { |
| 1731 DCHECK(trailing_ping_pending_); | 1780 DCHECK(trailing_ping_pending_); |
| 1732 trailing_ping_pending_ = false; | 1781 trailing_ping_pending_ = false; |
| 1733 WritePingFrame(next_ping_id_); | 1782 WritePingFrame(next_ping_id_); |
| 1734 } | 1783 } |
| 1735 | 1784 |
| 1736 void SpdySession::WritePingFrame(uint32 unique_id) { | 1785 void SpdySession::WritePingFrame(uint32 unique_id) { |
| 1737 DCHECK(buffered_spdy_framer_.get()); | 1786 DCHECK(buffered_spdy_framer_.get()); |
| 1738 scoped_ptr<spdy::SpdyPingControlFrame> ping_frame( | 1787 scoped_ptr<spdy::SpdyPingControlFrame> ping_frame( |
| 1739 spdy::SpdyFramer::CreatePingFrame(next_ping_id_)); | 1788 buffered_spdy_framer_->CreatePingFrame(next_ping_id_)); |
| 1740 QueueFrame(ping_frame.get(), SPDY_PRIORITY_HIGHEST, NULL); | 1789 QueueFrame( |
| 1790 ping_frame.get(), buffered_spdy_framer_->GetHighestPriority(), NULL); |
| 1741 | 1791 |
| 1742 if (net_log().IsLoggingAllEvents()) { | 1792 if (net_log().IsLoggingAllEvents()) { |
| 1743 net_log().AddEvent( | 1793 net_log().AddEvent( |
| 1744 NetLog::TYPE_SPDY_SESSION_PING, | 1794 NetLog::TYPE_SPDY_SESSION_PING, |
| 1745 make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent"))); | 1795 make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent"))); |
| 1746 } | 1796 } |
| 1747 if (unique_id % 2 != 0) { | 1797 if (unique_id % 2 != 0) { |
| 1748 next_ping_id_ += 2; | 1798 next_ping_id_ += 2; |
| 1749 ++pings_in_flight_; | 1799 ++pings_in_flight_; |
| 1750 need_to_send_ping_ = false; | 1800 need_to_send_ping_ = false; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 SSLClientSocket* SpdySession::GetSSLClientSocket() const { | 1941 SSLClientSocket* SpdySession::GetSSLClientSocket() const { |
| 1892 if (!is_secure_) | 1942 if (!is_secure_) |
| 1893 return NULL; | 1943 return NULL; |
| 1894 SSLClientSocket* ssl_socket = | 1944 SSLClientSocket* ssl_socket = |
| 1895 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 1945 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
| 1896 DCHECK(ssl_socket); | 1946 DCHECK(ssl_socket); |
| 1897 return ssl_socket; | 1947 return ssl_socket; |
| 1898 } | 1948 } |
| 1899 | 1949 |
| 1900 } // namespace net | 1950 } // namespace net |
| OLD | NEW |