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 break; | |
Ryan Hamilton
2012/03/10 03:23:02
I'm not sure I understand why you had to change th
ramant (doing other things)
2012/03/10 19:45:29
Changed it back to 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<uint32, 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; |
1635 switch (id) { | 1669 switch (id) { |
1636 case spdy::SETTINGS_CURRENT_CWND: | 1670 case spdy::SETTINGS_CURRENT_CWND: |
1637 uint32 cwnd = 0; | 1671 uint32 cwnd = 0; |
1638 cwnd = ApplyCwndFieldTrialPolicy(val); | 1672 cwnd = ApplyCwndFieldTrialPolicy(val); |
1639 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", | 1673 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.SpdySettingsCwndSent", |
1640 cwnd, | 1674 cwnd, |
1641 1, 200, 100); | 1675 1, 200, 100); |
1642 if (cwnd != val) { | 1676 if (cwnd != val) { |
1677 spdy::SettingsFlagsAndId new_id(spdy::SETTINGS_FLAG_PLEASE_PERSIST, | |
1678 id); | |
1643 i->second = cwnd; | 1679 i->second = cwnd; |
1644 i->first.set_flags(spdy::SETTINGS_FLAG_PLEASE_PERSIST); | 1680 i->first = new_id; |
1645 http_server_properties_->SetSpdySettings(host_port_pair(), settings); | 1681 spdy::SpdySetting setting(new_id, val); |
1682 http_server_properties_->SetSpdySetting(host_port_pair(), setting); | |
1683 unique_settings[id] = setting; | |
1684 continue; | |
1646 } | 1685 } |
1647 break; | |
1648 } | 1686 } |
1687 unique_settings[id] = *i; | |
1649 } | 1688 } |
1650 | 1689 |
1651 HandleSettings(settings); | 1690 HandleSettings(settings); |
1652 | 1691 |
1653 net_log_.AddEvent( | 1692 net_log_.AddEvent( |
1654 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, | 1693 NetLog::TYPE_SPDY_SESSION_SEND_SETTINGS, |
1655 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); | 1694 make_scoped_refptr(new NetLogSpdySettingsParameter(settings))); |
1656 | 1695 |
1696 spdy::SpdySettings sorted_settings; | |
1697 for (SpdySettingsMap::iterator it = unique_settings.begin(); | |
1698 unique_settings.end() != it; | |
1699 ++it) { | |
1700 sorted_settings.push_back(it->second); | |
1701 } | |
1702 | |
1657 // Create the SETTINGS frame and send it. | 1703 // Create the SETTINGS frame and send it. |
1658 DCHECK(buffered_spdy_framer_.get()); | 1704 DCHECK(buffered_spdy_framer_.get()); |
1659 scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( | 1705 scoped_ptr<spdy::SpdySettingsControlFrame> settings_frame( |
1660 buffered_spdy_framer_->CreateSettings(settings)); | 1706 buffered_spdy_framer_->CreateSettings(sorted_settings)); |
1661 sent_settings_ = true; | 1707 sent_settings_ = true; |
1662 QueueFrame(settings_frame.get(), 0, NULL); | 1708 QueueFrame(settings_frame.get(), 0, NULL); |
1663 } | 1709 } |
1664 | 1710 |
1665 void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { | 1711 void SpdySession::HandleSettings(const spdy::SpdySettings& settings) { |
1666 for (spdy::SpdySettings::const_iterator i = settings.begin(), | 1712 for (spdy::SpdySettings::const_iterator i = settings.begin(), |
1667 end = settings.end(); i != end; ++i) { | 1713 end = settings.end(); i != end; ++i) { |
1668 const uint32 id = i->first.id(); | 1714 HandleSetting(i->first.id(), i->second); |
1669 const uint32 val = i->second; | 1715 } |
1670 switch (id) { | 1716 } |
1671 case spdy::SETTINGS_MAX_CONCURRENT_STREAMS: | 1717 |
1672 max_concurrent_streams_ = std::min(static_cast<size_t>(val), | 1718 void SpdySession::HandleSetting(uint32 id, uint32 value) { |
1673 max_concurrent_stream_limit_); | 1719 switch (id) { |
1674 ProcessPendingCreateStreams(); | 1720 case spdy::SETTINGS_MAX_CONCURRENT_STREAMS: |
1675 break; | 1721 max_concurrent_streams_ = std::min(static_cast<size_t>(value), |
1676 case spdy::SETTINGS_INITIAL_WINDOW_SIZE: | 1722 max_concurrent_stream_limit_); |
1677 // INITIAL_WINDOW_SIZE updates initial_send_window_size_ only. | 1723 ProcessPendingCreateStreams(); |
1678 // TODO(rtenneti): discuss with the server team about | 1724 break; |
1679 // initial_recv_window_size_. | 1725 case spdy::SETTINGS_INITIAL_WINDOW_SIZE: |
1680 int32 prev_initial_send_window_size = initial_send_window_size_; | 1726 // INITIAL_WINDOW_SIZE updates initial_send_window_size_ only. |
1681 initial_send_window_size_ = val; | 1727 // TODO(rtenneti): discuss with the server team about |
1682 int32 delta_window_size = | 1728 // initial_recv_window_size_. |
1683 initial_send_window_size_ - prev_initial_send_window_size; | 1729 int32 prev_initial_send_window_size = initial_send_window_size_; |
1684 UpdateStreamsSendWindowSize(delta_window_size); | 1730 initial_send_window_size_ = value; |
1685 break; | 1731 int32 delta_window_size = |
1686 } | 1732 initial_send_window_size_ - prev_initial_send_window_size; |
1733 UpdateStreamsSendWindowSize(delta_window_size); | |
1734 break; | |
1687 } | 1735 } |
1688 } | 1736 } |
1689 | 1737 |
1690 void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { | 1738 void SpdySession::UpdateStreamsSendWindowSize(int32 delta_window_size) { |
1691 ActiveStreamMap::iterator it; | 1739 ActiveStreamMap::iterator it; |
1692 for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { | 1740 for (it = active_streams_.begin(); it != active_streams_.end(); ++it) { |
1693 const scoped_refptr<SpdyStream>& stream = it->second; | 1741 const scoped_refptr<SpdyStream>& stream = it->second; |
1694 DCHECK(stream); | 1742 DCHECK(stream); |
1695 stream->AdjustSendWindowSize(delta_window_size); | 1743 stream->AdjustSendWindowSize(delta_window_size); |
1696 } | 1744 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1729 | 1777 |
1730 void SpdySession::SendTrailingPing() { | 1778 void SpdySession::SendTrailingPing() { |
1731 DCHECK(trailing_ping_pending_); | 1779 DCHECK(trailing_ping_pending_); |
1732 trailing_ping_pending_ = false; | 1780 trailing_ping_pending_ = false; |
1733 WritePingFrame(next_ping_id_); | 1781 WritePingFrame(next_ping_id_); |
1734 } | 1782 } |
1735 | 1783 |
1736 void SpdySession::WritePingFrame(uint32 unique_id) { | 1784 void SpdySession::WritePingFrame(uint32 unique_id) { |
1737 DCHECK(buffered_spdy_framer_.get()); | 1785 DCHECK(buffered_spdy_framer_.get()); |
1738 scoped_ptr<spdy::SpdyPingControlFrame> ping_frame( | 1786 scoped_ptr<spdy::SpdyPingControlFrame> ping_frame( |
1739 spdy::SpdyFramer::CreatePingFrame(next_ping_id_)); | 1787 buffered_spdy_framer_->CreatePingFrame(next_ping_id_)); |
1740 QueueFrame(ping_frame.get(), SPDY_PRIORITY_HIGHEST, NULL); | 1788 QueueFrame( |
1789 ping_frame.get(), buffered_spdy_framer_->GetHighestPriority(), NULL); | |
1741 | 1790 |
1742 if (net_log().IsLoggingAllEvents()) { | 1791 if (net_log().IsLoggingAllEvents()) { |
1743 net_log().AddEvent( | 1792 net_log().AddEvent( |
1744 NetLog::TYPE_SPDY_SESSION_PING, | 1793 NetLog::TYPE_SPDY_SESSION_PING, |
1745 make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent"))); | 1794 make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent"))); |
1746 } | 1795 } |
1747 if (unique_id % 2 != 0) { | 1796 if (unique_id % 2 != 0) { |
1748 next_ping_id_ += 2; | 1797 next_ping_id_ += 2; |
1749 ++pings_in_flight_; | 1798 ++pings_in_flight_; |
1750 need_to_send_ping_ = false; | 1799 need_to_send_ping_ = false; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1891 SSLClientSocket* SpdySession::GetSSLClientSocket() const { | 1940 SSLClientSocket* SpdySession::GetSSLClientSocket() const { |
1892 if (!is_secure_) | 1941 if (!is_secure_) |
1893 return NULL; | 1942 return NULL; |
1894 SSLClientSocket* ssl_socket = | 1943 SSLClientSocket* ssl_socket = |
1895 reinterpret_cast<SSLClientSocket*>(connection_->socket()); | 1944 reinterpret_cast<SSLClientSocket*>(connection_->socket()); |
1896 DCHECK(ssl_socket); | 1945 DCHECK(ssl_socket); |
1897 return ssl_socket; | 1946 return ssl_socket; |
1898 } | 1947 } |
1899 | 1948 |
1900 } // namespace net | 1949 } // namespace net |
OLD | NEW |