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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <map> | 9 #include <map> |
10 #include <utility> | 10 #include <utility> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 NetLogCaptureMode capture_mode) { | 131 NetLogCaptureMode capture_mode) { |
132 auto dict = base::MakeUnique<base::DictionaryValue>(); | 132 auto dict = base::MakeUnique<base::DictionaryValue>(); |
133 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode)); | 133 dict->Set("headers", ElideSpdyHeaderBlockForNetLog(*headers, capture_mode)); |
134 dict->SetBoolean("fin", fin); | 134 dict->SetBoolean("fin", fin); |
135 dict->SetInteger("stream_id", stream_id); | 135 dict->SetInteger("stream_id", stream_id); |
136 return std::move(dict); | 136 return std::move(dict); |
137 } | 137 } |
138 | 138 |
139 std::unique_ptr<base::Value> NetLogSpdySessionCloseCallback( | 139 std::unique_ptr<base::Value> NetLogSpdySessionCloseCallback( |
140 int net_error, | 140 int net_error, |
141 const std::string* description, | 141 const SpdyString* description, |
142 NetLogCaptureMode /* capture_mode */) { | 142 NetLogCaptureMode /* capture_mode */) { |
143 auto dict = base::MakeUnique<base::DictionaryValue>(); | 143 auto dict = base::MakeUnique<base::DictionaryValue>(); |
144 dict->SetInteger("net_error", net_error); | 144 dict->SetInteger("net_error", net_error); |
145 dict->SetString("description", *description); | 145 dict->SetString("description", *description); |
146 return std::move(dict); | 146 return std::move(dict); |
147 } | 147 } |
148 | 148 |
149 std::unique_ptr<base::Value> NetLogSpdySessionCallback( | 149 std::unique_ptr<base::Value> NetLogSpdySessionCallback( |
150 const HostPortProxyPair* host_pair, | 150 const HostPortProxyPair* host_pair, |
151 NetLogCaptureMode /* capture_mode */) { | 151 NetLogCaptureMode /* capture_mode */) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 dict->SetInteger("stream_id", static_cast<int>(stream_id)); | 244 dict->SetInteger("stream_id", static_cast<int>(stream_id)); |
245 dict->SetString( | 245 dict->SetString( |
246 "error_code", | 246 "error_code", |
247 SpdyStringPrintf("%u (%s)", error_code, ErrorCodeToString(error_code))); | 247 SpdyStringPrintf("%u (%s)", error_code, ErrorCodeToString(error_code))); |
248 return std::move(dict); | 248 return std::move(dict); |
249 } | 249 } |
250 | 250 |
251 std::unique_ptr<base::Value> NetLogSpdySendRstStreamCallback( | 251 std::unique_ptr<base::Value> NetLogSpdySendRstStreamCallback( |
252 SpdyStreamId stream_id, | 252 SpdyStreamId stream_id, |
253 SpdyErrorCode error_code, | 253 SpdyErrorCode error_code, |
254 const std::string* description, | 254 const SpdyString* description, |
255 NetLogCaptureMode /* capture_mode */) { | 255 NetLogCaptureMode /* capture_mode */) { |
256 auto dict = base::MakeUnique<base::DictionaryValue>(); | 256 auto dict = base::MakeUnique<base::DictionaryValue>(); |
257 dict->SetInteger("stream_id", static_cast<int>(stream_id)); | 257 dict->SetInteger("stream_id", static_cast<int>(stream_id)); |
258 dict->SetString( | 258 dict->SetString( |
259 "error_code", | 259 "error_code", |
260 SpdyStringPrintf("%u (%s)", error_code, ErrorCodeToString(error_code))); | 260 SpdyStringPrintf("%u (%s)", error_code, ErrorCodeToString(error_code))); |
261 dict->SetString("description", *description); | 261 dict->SetString("description", *description); |
262 return std::move(dict); | 262 return std::move(dict); |
263 } | 263 } |
264 | 264 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 dict->SetInteger("stream_id", stream_id); | 313 dict->SetInteger("stream_id", stream_id); |
314 dict->SetString("url", url->spec()); | 314 dict->SetString("url", url->spec()); |
315 return std::move(dict); | 315 return std::move(dict); |
316 } | 316 } |
317 | 317 |
318 std::unique_ptr<base::Value> NetLogSpdySessionStalledCallback( | 318 std::unique_ptr<base::Value> NetLogSpdySessionStalledCallback( |
319 size_t num_active_streams, | 319 size_t num_active_streams, |
320 size_t num_created_streams, | 320 size_t num_created_streams, |
321 size_t num_pushed_streams, | 321 size_t num_pushed_streams, |
322 size_t max_concurrent_streams, | 322 size_t max_concurrent_streams, |
323 const std::string& url, | 323 const SpdyString& url, |
324 NetLogCaptureMode capture_mode) { | 324 NetLogCaptureMode capture_mode) { |
325 auto dict = base::MakeUnique<base::DictionaryValue>(); | 325 auto dict = base::MakeUnique<base::DictionaryValue>(); |
326 dict->SetInteger("num_active_streams", num_active_streams); | 326 dict->SetInteger("num_active_streams", num_active_streams); |
327 dict->SetInteger("num_created_streams", num_created_streams); | 327 dict->SetInteger("num_created_streams", num_created_streams); |
328 dict->SetInteger("num_pushed_streams", num_pushed_streams); | 328 dict->SetInteger("num_pushed_streams", num_pushed_streams); |
329 dict->SetInteger("max_concurrent_streams", max_concurrent_streams); | 329 dict->SetInteger("max_concurrent_streams", max_concurrent_streams); |
330 dict->SetString("url", url); | 330 dict->SetString("url", url); |
331 return std::move(dict); | 331 return std::move(dict); |
332 } | 332 } |
333 | 333 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 } | 671 } |
672 | 672 |
673 size_t SpdySession::UnclaimedPushedStreamContainer::EstimateMemoryUsage() | 673 size_t SpdySession::UnclaimedPushedStreamContainer::EstimateMemoryUsage() |
674 const { | 674 const { |
675 return SpdyEstimateMemoryUsage(streams_); | 675 return SpdyEstimateMemoryUsage(streams_); |
676 } | 676 } |
677 | 677 |
678 // static | 678 // static |
679 bool SpdySession::CanPool(TransportSecurityState* transport_security_state, | 679 bool SpdySession::CanPool(TransportSecurityState* transport_security_state, |
680 const SSLInfo& ssl_info, | 680 const SSLInfo& ssl_info, |
681 const std::string& old_hostname, | 681 const SpdyString& old_hostname, |
682 const std::string& new_hostname) { | 682 const SpdyString& new_hostname) { |
683 // Pooling is prohibited if the server cert is not valid for the new domain, | 683 // Pooling is prohibited if the server cert is not valid for the new domain, |
684 // and for connections on which client certs were sent. It is also prohibited | 684 // and for connections on which client certs were sent. It is also prohibited |
685 // when channel ID was sent if the hosts are from different eTLDs+1. | 685 // when channel ID was sent if the hosts are from different eTLDs+1. |
686 if (IsCertStatusError(ssl_info.cert_status)) | 686 if (IsCertStatusError(ssl_info.cert_status)) |
687 return false; | 687 return false; |
688 | 688 |
689 if (ssl_info.client_cert_sent) | 689 if (ssl_info.client_cert_sent) |
690 return false; | 690 return false; |
691 | 691 |
692 if (ssl_info.channel_id_sent && | 692 if (ssl_info.channel_id_sent && |
693 ChannelIDService::GetDomainForHost(new_hostname) != | 693 ChannelIDService::GetDomainForHost(new_hostname) != |
694 ChannelIDService::GetDomainForHost(old_hostname)) { | 694 ChannelIDService::GetDomainForHost(old_hostname)) { |
695 return false; | 695 return false; |
696 } | 696 } |
697 | 697 |
698 if (!ssl_info.cert->VerifyNameMatch(new_hostname, false)) | 698 if (!ssl_info.cert->VerifyNameMatch(new_hostname, false)) |
699 return false; | 699 return false; |
700 | 700 |
701 std::string pinning_failure_log; | 701 SpdyString pinning_failure_log; |
702 // DISABLE_PIN_REPORTS is set here because this check can fail in | 702 // DISABLE_PIN_REPORTS is set here because this check can fail in |
703 // normal operation without being indicative of a misconfiguration or | 703 // normal operation without being indicative of a misconfiguration or |
704 // attack. Port is left at 0 as it is never used. | 704 // attack. Port is left at 0 as it is never used. |
705 if (transport_security_state->CheckPublicKeyPins( | 705 if (transport_security_state->CheckPublicKeyPins( |
706 HostPortPair(new_hostname, 0), ssl_info.is_issued_by_known_root, | 706 HostPortPair(new_hostname, 0), ssl_info.is_issued_by_known_root, |
707 ssl_info.public_key_hashes, ssl_info.unverified_cert.get(), | 707 ssl_info.public_key_hashes, ssl_info.unverified_cert.get(), |
708 ssl_info.cert.get(), TransportSecurityState::DISABLE_PIN_REPORTS, | 708 ssl_info.cert.get(), TransportSecurityState::DISABLE_PIN_REPORTS, |
709 &pinning_failure_log) == | 709 &pinning_failure_log) == |
710 TransportSecurityState::PKPStatus::VIOLATED) { | 710 TransportSecurityState::PKPStatus::VIOLATED) { |
711 return false; | 711 return false; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 SendInitialData(); | 903 SendInitialData(); |
904 pool_ = pool; | 904 pool_ = pool; |
905 | 905 |
906 // Bootstrap the read loop. | 906 // Bootstrap the read loop. |
907 base::ThreadTaskRunnerHandle::Get()->PostTask( | 907 base::ThreadTaskRunnerHandle::Get()->PostTask( |
908 FROM_HERE, | 908 FROM_HERE, |
909 base::Bind(&SpdySession::PumpReadLoop, weak_factory_.GetWeakPtr(), | 909 base::Bind(&SpdySession::PumpReadLoop, weak_factory_.GetWeakPtr(), |
910 READ_STATE_DO_READ, OK)); | 910 READ_STATE_DO_READ, OK)); |
911 } | 911 } |
912 | 912 |
913 bool SpdySession::VerifyDomainAuthentication(const std::string& domain) { | 913 bool SpdySession::VerifyDomainAuthentication(const SpdyString& domain) { |
914 if (availability_state_ == STATE_DRAINING) | 914 if (availability_state_ == STATE_DRAINING) |
915 return false; | 915 return false; |
916 | 916 |
917 SSLInfo ssl_info; | 917 SSLInfo ssl_info; |
918 if (!GetSSLInfo(&ssl_info)) | 918 if (!GetSSLInfo(&ssl_info)) |
919 return true; // This is not a secure session, so all domains are okay. | 919 return true; // This is not a secure session, so all domains are okay. |
920 | 920 |
921 return CanPool(transport_security_state_, ssl_info, host_port_pair().host(), | 921 return CanPool(transport_security_state_, ssl_info, host_port_pair().host(), |
922 domain); | 922 domain); |
923 } | 923 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 if (it == created_streams_.end()) { | 1108 if (it == created_streams_.end()) { |
1109 NOTREACHED(); | 1109 NOTREACHED(); |
1110 return; | 1110 return; |
1111 } | 1111 } |
1112 | 1112 |
1113 CloseCreatedStreamIterator(it, status); | 1113 CloseCreatedStreamIterator(it, status); |
1114 } | 1114 } |
1115 | 1115 |
1116 void SpdySession::ResetStream(SpdyStreamId stream_id, | 1116 void SpdySession::ResetStream(SpdyStreamId stream_id, |
1117 SpdyErrorCode error_code, | 1117 SpdyErrorCode error_code, |
1118 const std::string& description) { | 1118 const SpdyString& description) { |
1119 DCHECK_NE(stream_id, 0u); | 1119 DCHECK_NE(stream_id, 0u); |
1120 | 1120 |
1121 ActiveStreamMap::iterator it = active_streams_.find(stream_id); | 1121 ActiveStreamMap::iterator it = active_streams_.find(stream_id); |
1122 if (it == active_streams_.end()) { | 1122 if (it == active_streams_.end()) { |
1123 NOTREACHED(); | 1123 NOTREACHED(); |
1124 return; | 1124 return; |
1125 } | 1125 } |
1126 | 1126 |
1127 ResetStreamIterator(it, error_code, description); | 1127 ResetStreamIterator(it, error_code, description); |
1128 } | 1128 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 | 1172 |
1173 void SpdySession::SendStreamWindowUpdate(SpdyStreamId stream_id, | 1173 void SpdySession::SendStreamWindowUpdate(SpdyStreamId stream_id, |
1174 uint32_t delta_window_size) { | 1174 uint32_t delta_window_size) { |
1175 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); | 1175 ActiveStreamMap::const_iterator it = active_streams_.find(stream_id); |
1176 CHECK(it != active_streams_.end()); | 1176 CHECK(it != active_streams_.end()); |
1177 CHECK_EQ(it->second->stream_id(), stream_id); | 1177 CHECK_EQ(it->second->stream_id(), stream_id); |
1178 SendWindowUpdateFrame(stream_id, delta_window_size, it->second->priority()); | 1178 SendWindowUpdateFrame(stream_id, delta_window_size, it->second->priority()); |
1179 } | 1179 } |
1180 | 1180 |
1181 void SpdySession::CloseSessionOnError(Error err, | 1181 void SpdySession::CloseSessionOnError(Error err, |
1182 const std::string& description) { | 1182 const SpdyString& description) { |
1183 DCHECK_LT(err, ERR_IO_PENDING); | 1183 DCHECK_LT(err, ERR_IO_PENDING); |
1184 DoDrainSession(err, description); | 1184 DoDrainSession(err, description); |
1185 } | 1185 } |
1186 | 1186 |
1187 void SpdySession::MakeUnavailable() { | 1187 void SpdySession::MakeUnavailable() { |
1188 if (availability_state_ == STATE_AVAILABLE) { | 1188 if (availability_state_ == STATE_AVAILABLE) { |
1189 availability_state_ = STATE_GOING_AWAY; | 1189 availability_state_ = STATE_GOING_AWAY; |
1190 pool_->MakeSessionUnavailable(GetWeakPtr()); | 1190 pool_->MakeSessionUnavailable(GetWeakPtr()); |
1191 } | 1191 } |
1192 } | 1192 } |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 // probably should be. | 1567 // probably should be. |
1568 EnqueueResetStreamFrame(stream_id, request_priority, | 1568 EnqueueResetStreamFrame(stream_id, request_priority, |
1569 ERROR_CODE_REFUSED_STREAM, | 1569 ERROR_CODE_REFUSED_STREAM, |
1570 "push stream request received when going away"); | 1570 "push stream request received when going away"); |
1571 return; | 1571 return; |
1572 } | 1572 } |
1573 | 1573 |
1574 if (associated_stream_id == 0) { | 1574 if (associated_stream_id == 0) { |
1575 // In HTTP/2 0 stream id in PUSH_PROMISE frame leads to framer error and | 1575 // In HTTP/2 0 stream id in PUSH_PROMISE frame leads to framer error and |
1576 // session going away. We should never get here. | 1576 // session going away. We should never get here. |
1577 std::string description = SpdyStringPrintf( | 1577 SpdyString description = SpdyStringPrintf( |
1578 "Received invalid associated stream id %d for pushed stream %d", | 1578 "Received invalid associated stream id %d for pushed stream %d", |
1579 associated_stream_id, stream_id); | 1579 associated_stream_id, stream_id); |
1580 EnqueueResetStreamFrame(stream_id, request_priority, | 1580 EnqueueResetStreamFrame(stream_id, request_priority, |
1581 ERROR_CODE_REFUSED_STREAM, description); | 1581 ERROR_CODE_REFUSED_STREAM, description); |
1582 return; | 1582 return; |
1583 } | 1583 } |
1584 | 1584 |
1585 streams_pushed_count_++; | 1585 streams_pushed_count_++; |
1586 | 1586 |
1587 // TODO(mbelshe): DCHECK that this is a GET method? | 1587 // TODO(mbelshe): DCHECK that this is a GET method? |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 | 1747 |
1748 void SpdySession::CloseCreatedStreamIterator(CreatedStreamSet::iterator it, | 1748 void SpdySession::CloseCreatedStreamIterator(CreatedStreamSet::iterator it, |
1749 int status) { | 1749 int status) { |
1750 std::unique_ptr<SpdyStream> owned_stream(*it); | 1750 std::unique_ptr<SpdyStream> owned_stream(*it); |
1751 created_streams_.erase(it); | 1751 created_streams_.erase(it); |
1752 DeleteStream(std::move(owned_stream), status); | 1752 DeleteStream(std::move(owned_stream), status); |
1753 } | 1753 } |
1754 | 1754 |
1755 void SpdySession::ResetStreamIterator(ActiveStreamMap::iterator it, | 1755 void SpdySession::ResetStreamIterator(ActiveStreamMap::iterator it, |
1756 SpdyErrorCode error_code, | 1756 SpdyErrorCode error_code, |
1757 const std::string& description) { | 1757 const SpdyString& description) { |
1758 // Send the RST_STREAM frame first as CloseActiveStreamIterator() | 1758 // Send the RST_STREAM frame first as CloseActiveStreamIterator() |
1759 // may close us. | 1759 // may close us. |
1760 SpdyStreamId stream_id = it->first; | 1760 SpdyStreamId stream_id = it->first; |
1761 RequestPriority priority = it->second->priority(); | 1761 RequestPriority priority = it->second->priority(); |
1762 EnqueueResetStreamFrame(stream_id, priority, error_code, description); | 1762 EnqueueResetStreamFrame(stream_id, priority, error_code, description); |
1763 | 1763 |
1764 // Removes any pending writes for the stream except for possibly an | 1764 // Removes any pending writes for the stream except for possibly an |
1765 // in-flight one. | 1765 // in-flight one. |
1766 CloseActiveStreamIterator(it, ERR_SPDY_PROTOCOL_ERROR); | 1766 CloseActiveStreamIterator(it, ERR_SPDY_PROTOCOL_ERROR); |
1767 } | 1767 } |
1768 | 1768 |
1769 void SpdySession::EnqueueResetStreamFrame(SpdyStreamId stream_id, | 1769 void SpdySession::EnqueueResetStreamFrame(SpdyStreamId stream_id, |
1770 RequestPriority priority, | 1770 RequestPriority priority, |
1771 SpdyErrorCode error_code, | 1771 SpdyErrorCode error_code, |
1772 const std::string& description) { | 1772 const SpdyString& description) { |
1773 DCHECK_NE(stream_id, 0u); | 1773 DCHECK_NE(stream_id, 0u); |
1774 | 1774 |
1775 net_log().AddEvent(NetLogEventType::HTTP2_SESSION_SEND_RST_STREAM, | 1775 net_log().AddEvent(NetLogEventType::HTTP2_SESSION_SEND_RST_STREAM, |
1776 base::Bind(&NetLogSpdySendRstStreamCallback, stream_id, | 1776 base::Bind(&NetLogSpdySendRstStreamCallback, stream_id, |
1777 error_code, &description)); | 1777 error_code, &description)); |
1778 | 1778 |
1779 DCHECK(buffered_spdy_framer_.get()); | 1779 DCHECK(buffered_spdy_framer_.get()); |
1780 std::unique_ptr<SpdySerializedFrame> rst_frame( | 1780 std::unique_ptr<SpdySerializedFrame> rst_frame( |
1781 buffered_spdy_framer_->CreateRstStream(stream_id, error_code)); | 1781 buffered_spdy_framer_->CreateRstStream(stream_id, error_code)); |
1782 | 1782 |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 #endif | 2446 #endif |
2447 } | 2447 } |
2448 | 2448 |
2449 void SpdySession::DcheckDraining() const { | 2449 void SpdySession::DcheckDraining() const { |
2450 DcheckGoingAway(); | 2450 DcheckGoingAway(); |
2451 DCHECK_EQ(availability_state_, STATE_DRAINING); | 2451 DCHECK_EQ(availability_state_, STATE_DRAINING); |
2452 DCHECK(active_streams_.empty()); | 2452 DCHECK(active_streams_.empty()); |
2453 DCHECK(unclaimed_pushed_streams_.empty()); | 2453 DCHECK(unclaimed_pushed_streams_.empty()); |
2454 } | 2454 } |
2455 | 2455 |
2456 void SpdySession::DoDrainSession(Error err, const std::string& description) { | 2456 void SpdySession::DoDrainSession(Error err, const SpdyString& description) { |
2457 if (availability_state_ == STATE_DRAINING) { | 2457 if (availability_state_ == STATE_DRAINING) { |
2458 return; | 2458 return; |
2459 } | 2459 } |
2460 MakeUnavailable(); | 2460 MakeUnavailable(); |
2461 | 2461 |
2462 // Mark host_port_pair requiring HTTP/1.1 for subsequent connections. | 2462 // Mark host_port_pair requiring HTTP/1.1 for subsequent connections. |
2463 if (err == ERR_HTTP_1_1_REQUIRED) { | 2463 if (err == ERR_HTTP_1_1_REQUIRED) { |
2464 http_server_properties_->SetHTTP11Required(host_port_pair()); | 2464 http_server_properties_->SetHTTP11Required(host_port_pair()); |
2465 } | 2465 } |
2466 | 2466 |
(...skipping 30 matching lines...) Expand all Loading... |
2497 DcheckGoingAway(); | 2497 DcheckGoingAway(); |
2498 } else { | 2498 } else { |
2499 StartGoingAway(0, err); | 2499 StartGoingAway(0, err); |
2500 } | 2500 } |
2501 DcheckDraining(); | 2501 DcheckDraining(); |
2502 MaybePostWriteLoop(); | 2502 MaybePostWriteLoop(); |
2503 } | 2503 } |
2504 | 2504 |
2505 void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { | 2505 void SpdySession::LogAbandonedStream(SpdyStream* stream, Error status) { |
2506 DCHECK(stream); | 2506 DCHECK(stream); |
2507 std::string description = | 2507 SpdyString description = |
2508 SpdyStringPrintf("ABANDONED (stream_id=%d): ", stream->stream_id()) + | 2508 SpdyStringPrintf("ABANDONED (stream_id=%d): ", stream->stream_id()) + |
2509 stream->url().spec(); | 2509 stream->url().spec(); |
2510 stream->LogStreamError(status, description); | 2510 stream->LogStreamError(status, description); |
2511 // We don't increment the streams abandoned counter here. If the | 2511 // We don't increment the streams abandoned counter here. If the |
2512 // stream isn't active (i.e., it hasn't written anything to the wire | 2512 // stream isn't active (i.e., it hasn't written anything to the wire |
2513 // yet) then it's as if it never existed. If it is active, then | 2513 // yet) then it's as if it never existed. If it is active, then |
2514 // LogAbandonedActiveStream() will increment the counters. | 2514 // LogAbandonedActiveStream() will increment the counters. |
2515 } | 2515 } |
2516 | 2516 |
2517 void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, | 2517 void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2580 next_unclaimed_push_stream_sweep_time_ = | 2580 next_unclaimed_push_stream_sweep_time_ = |
2581 time_func_() + | 2581 time_func_() + |
2582 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); | 2582 base::TimeDelta::FromSeconds(kMinPushedStreamLifetimeSeconds); |
2583 } | 2583 } |
2584 | 2584 |
2585 void SpdySession::OnError(SpdyFramer::SpdyFramerError spdy_framer_error) { | 2585 void SpdySession::OnError(SpdyFramer::SpdyFramerError spdy_framer_error) { |
2586 CHECK(in_io_loop_); | 2586 CHECK(in_io_loop_); |
2587 | 2587 |
2588 RecordProtocolErrorHistogram( | 2588 RecordProtocolErrorHistogram( |
2589 MapFramerErrorToProtocolError(spdy_framer_error)); | 2589 MapFramerErrorToProtocolError(spdy_framer_error)); |
2590 std::string description = | 2590 SpdyString description = |
2591 SpdyStringPrintf("Framer error: %d (%s).", spdy_framer_error, | 2591 SpdyStringPrintf("Framer error: %d (%s).", spdy_framer_error, |
2592 SpdyFramer::SpdyFramerErrorToString(spdy_framer_error)); | 2592 SpdyFramer::SpdyFramerErrorToString(spdy_framer_error)); |
2593 DoDrainSession(MapFramerErrorToNetError(spdy_framer_error), description); | 2593 DoDrainSession(MapFramerErrorToNetError(spdy_framer_error), description); |
2594 } | 2594 } |
2595 | 2595 |
2596 void SpdySession::OnStreamError(SpdyStreamId stream_id, | 2596 void SpdySession::OnStreamError(SpdyStreamId stream_id, |
2597 const std::string& description) { | 2597 const SpdyString& description) { |
2598 CHECK(in_io_loop_); | 2598 CHECK(in_io_loop_); |
2599 | 2599 |
2600 ActiveStreamMap::iterator it = active_streams_.find(stream_id); | 2600 ActiveStreamMap::iterator it = active_streams_.find(stream_id); |
2601 if (it == active_streams_.end()) { | 2601 if (it == active_streams_.end()) { |
2602 // We still want to send a frame to reset the stream even if we | 2602 // We still want to send a frame to reset the stream even if we |
2603 // don't know anything about it. | 2603 // don't know anything about it. |
2604 EnqueueResetStreamFrame(stream_id, IDLE, ERROR_CODE_PROTOCOL_ERROR, | 2604 EnqueueResetStreamFrame(stream_id, IDLE, ERROR_CODE_PROTOCOL_ERROR, |
2605 description); | 2605 description); |
2606 return; | 2606 return; |
2607 } | 2607 } |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3191 if (!queue->empty()) { | 3191 if (!queue->empty()) { |
3192 SpdyStreamId stream_id = queue->front(); | 3192 SpdyStreamId stream_id = queue->front(); |
3193 queue->pop_front(); | 3193 queue->pop_front(); |
3194 return stream_id; | 3194 return stream_id; |
3195 } | 3195 } |
3196 } | 3196 } |
3197 return 0; | 3197 return 0; |
3198 } | 3198 } |
3199 | 3199 |
3200 } // namespace net | 3200 } // namespace net |
OLD | NEW |