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
3 // found in the LICENSE file.
5 #include "net/quic/quic_session.h"
7 #include "base/stl_util.h"
8 #include "net/quic/crypto/proof_verifier.h"
9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_flags.h"
11 #include "net/quic/quic_flow_controller.h"
12 #include "net/ssl/ssl_info.h"
14 using base::StringPiece
;
26 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ")
28 // We want to make sure we delete any closed streams in a safe manner.
29 // To avoid deleting a stream in mid-operation, we have a simple shim between
30 // us and the stream, so we can delete any streams when we return from
33 // We could just override the base methods, but this makes it easier to make
34 // sure we don't miss any.
35 class VisitorShim
: public QuicConnectionVisitorInterface
{
37 explicit VisitorShim(QuicSession
* session
) : session_(session
) {}
39 void OnStreamFrame(const QuicStreamFrame
& frame
) override
{
40 session_
->OnStreamFrame(frame
);
41 session_
->PostProcessAfterData();
43 void OnRstStream(const QuicRstStreamFrame
& frame
) override
{
44 session_
->OnRstStream(frame
);
45 session_
->PostProcessAfterData();
48 void OnGoAway(const QuicGoAwayFrame
& frame
) override
{
49 session_
->OnGoAway(frame
);
50 session_
->PostProcessAfterData();
53 void OnWindowUpdateFrame(const QuicWindowUpdateFrame
& frame
) override
{
54 session_
->OnWindowUpdateFrame(frame
);
55 session_
->PostProcessAfterData();
58 void OnBlockedFrame(const QuicBlockedFrame
& frame
) override
{
59 session_
->OnBlockedFrame(frame
);
60 session_
->PostProcessAfterData();
63 void OnCanWrite() override
{
64 session_
->OnCanWrite();
65 session_
->PostProcessAfterData();
68 void OnCongestionWindowChange(QuicTime now
) override
{
69 session_
->OnCongestionWindowChange(now
);
72 void OnSuccessfulVersionNegotiation(const QuicVersion
& version
) override
{
73 session_
->OnSuccessfulVersionNegotiation(version
);
76 void OnConnectionClosed(QuicErrorCode error
, bool from_peer
) override
{
77 session_
->OnConnectionClosed(error
, from_peer
);
78 // The session will go away, so don't bother with cleanup.
81 void OnWriteBlocked() override
{ session_
->OnWriteBlocked(); }
83 bool WillingAndAbleToWrite() const override
{
84 return session_
->WillingAndAbleToWrite();
87 bool HasPendingHandshake() const override
{
88 return session_
->HasPendingHandshake();
91 bool HasOpenDynamicStreams() const override
{
92 return session_
->HasOpenDynamicStreams();
96 QuicSession
* session_
;
99 QuicSession::QuicSession(QuicConnection
* connection
, const QuicConfig
& config
)
100 : connection_(connection
),
101 visitor_shim_(new VisitorShim(this)),
103 max_open_streams_(config_
.MaxStreamsPerConnection()),
104 next_stream_id_(perspective() == Perspective::IS_SERVER
? 2 : 3),
105 largest_peer_created_stream_id_(
106 perspective() == Perspective::IS_SERVER
? 1 : 0),
107 error_(QUIC_NO_ERROR
),
108 flow_controller_(connection_
.get(),
111 kMinimumFlowControlSendWindow
,
112 config_
.GetInitialSessionFlowControlWindowToSend(),
114 goaway_received_(false),
116 has_pending_handshake_(false) {
119 void QuicSession::Initialize() {
120 connection_
->set_visitor(visitor_shim_
.get());
121 connection_
->SetFromConfig(config_
);
123 DCHECK_EQ(kCryptoStreamId
, GetCryptoStream()->id());
124 static_stream_map_
[kCryptoStreamId
] = GetCryptoStream();
127 QuicSession::~QuicSession() {
128 STLDeleteElements(&closed_streams_
);
129 STLDeleteValues(&dynamic_stream_map_
);
132 locally_closed_streams_highest_offset_
.size() > max_open_streams_
)
133 << "Surprisingly high number of locally closed streams still waiting for "
134 "final byte offset: " << locally_closed_streams_highest_offset_
.size();
137 void QuicSession::OnStreamFrame(const QuicStreamFrame
& frame
) {
138 // TODO(rch) deal with the error case of stream id 0.
139 QuicStreamId stream_id
= frame
.stream_id
;
140 ReliableQuicStream
* stream
= GetStream(stream_id
);
142 // The stream no longer exists, but we may still be interested in the
143 // final stream byte offset sent by the peer. A frame with a FIN can give
146 QuicStreamOffset final_byte_offset
= frame
.offset
+ frame
.data
.size();
147 UpdateFlowControlOnFinalReceivedByteOffset(stream_id
, final_byte_offset
);
151 stream
->OnStreamFrame(frame
);
154 void QuicSession::OnRstStream(const QuicRstStreamFrame
& frame
) {
155 if (ContainsKey(static_stream_map_
, frame
.stream_id
)) {
156 connection()->SendConnectionCloseWithDetails(
157 QUIC_INVALID_STREAM_ID
, "Attempt to reset a static stream");
161 ReliableQuicStream
* stream
= GetDynamicStream(frame
.stream_id
);
163 // The RST frame contains the final byte offset for the stream: we can now
164 // update the connection level flow controller if needed.
165 UpdateFlowControlOnFinalReceivedByteOffset(frame
.stream_id
,
167 return; // Errors are handled by GetStream.
170 stream
->OnStreamReset(frame
);
173 void QuicSession::OnGoAway(const QuicGoAwayFrame
& frame
) {
174 DCHECK(frame
.last_good_stream_id
< next_stream_id_
);
175 goaway_received_
= true;
178 void QuicSession::OnConnectionClosed(QuicErrorCode error
, bool from_peer
) {
179 DCHECK(!connection_
->connected());
180 if (error_
== QUIC_NO_ERROR
) {
184 while (!dynamic_stream_map_
.empty()) {
185 StreamMap::iterator it
= dynamic_stream_map_
.begin();
186 QuicStreamId id
= it
->first
;
187 it
->second
->OnConnectionClosed(error
, from_peer
);
188 // The stream should call CloseStream as part of OnConnectionClosed.
189 if (dynamic_stream_map_
.find(id
) != dynamic_stream_map_
.end()) {
190 LOG(DFATAL
) << ENDPOINT
191 << "Stream failed to close under OnConnectionClosed";
197 void QuicSession::OnSuccessfulVersionNegotiation(const QuicVersion
& version
) {
200 void QuicSession::OnWindowUpdateFrame(const QuicWindowUpdateFrame
& frame
) {
201 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't
202 // assume that it still exists.
203 QuicStreamId stream_id
= frame
.stream_id
;
204 if (stream_id
== kConnectionLevelId
) {
205 // This is a window update that applies to the connection, rather than an
206 // individual stream.
207 DVLOG(1) << ENDPOINT
<< "Received connection level flow control window "
208 "update with byte offset: "
209 << frame
.byte_offset
;
210 if (flow_controller_
.UpdateSendWindowOffset(frame
.byte_offset
)) {
211 // Connection level flow control window has increased, so blocked streams
213 // TODO(ianswett): I suspect this can be delayed until the packet
214 // processing is complete.
215 if (!FLAGS_quic_dont_write_when_flow_unblocked
) {
221 ReliableQuicStream
* stream
= GetStream(stream_id
);
223 stream
->OnWindowUpdateFrame(frame
);
227 void QuicSession::OnBlockedFrame(const QuicBlockedFrame
& frame
) {
228 // TODO(rjshade): Compare our flow control receive windows for specified
229 // streams: if we have a large window then maybe something
230 // had gone wrong with the flow control accounting.
232 << "Received BLOCKED frame with stream id: " << frame
.stream_id
;
235 void QuicSession::OnCanWrite() {
236 // We limit the number of writes to the number of pending streams. If more
237 // streams become pending, WillingAndAbleToWrite will be true, which will
238 // cause the connection to request resumption before yielding to other
240 size_t num_writes
= write_blocked_streams_
.NumBlockedStreams();
241 if (flow_controller_
.IsBlocked()) {
242 // If we are connection level flow control blocked, then only allow the
243 // crypto and headers streams to try writing as all other streams will be
246 if (write_blocked_streams_
.crypto_stream_blocked()) {
249 if (write_blocked_streams_
.headers_stream_blocked()) {
253 if (num_writes
== 0) {
257 QuicConnection::ScopedPacketBundler
ack_bundler(
258 connection_
.get(), QuicConnection::NO_ACK
);
259 for (size_t i
= 0; i
< num_writes
; ++i
) {
260 if (!(write_blocked_streams_
.HasWriteBlockedCryptoOrHeadersStream() ||
261 write_blocked_streams_
.HasWriteBlockedDataStreams())) {
262 // Writing one stream removed another!? Something's broken.
263 LOG(DFATAL
) << "WriteBlockedStream is missing";
264 connection_
->CloseConnection(QUIC_INTERNAL_ERROR
, false);
267 if (!connection_
->CanWriteStreamData()) {
270 QuicStreamId stream_id
= write_blocked_streams_
.PopFront();
271 if (stream_id
== kCryptoStreamId
) {
272 has_pending_handshake_
= false; // We just popped it.
274 ReliableQuicStream
* stream
= GetStream(stream_id
);
275 if (stream
!= nullptr && !stream
->flow_controller()->IsBlocked()) {
276 // If the stream can't write all bytes, it'll re-add itself to the blocked
278 stream
->OnCanWrite();
283 bool QuicSession::WillingAndAbleToWrite() const {
284 // If the crypto or headers streams are blocked, we want to schedule a write -
285 // they don't get blocked by connection level flow control. Otherwise only
286 // schedule a write if we are not flow control blocked at the connection
288 return write_blocked_streams_
.HasWriteBlockedCryptoOrHeadersStream() ||
289 (!flow_controller_
.IsBlocked() &&
290 write_blocked_streams_
.HasWriteBlockedDataStreams());
293 bool QuicSession::HasPendingHandshake() const {
294 return has_pending_handshake_
;
297 bool QuicSession::HasOpenDynamicStreams() const {
298 return GetNumOpenStreams() > 0;
301 QuicConsumedData
QuicSession::WritevData(
303 const QuicIOVector
& iov
,
304 QuicStreamOffset offset
,
306 FecProtection fec_protection
,
307 QuicAckNotifier::DelegateInterface
* ack_notifier_delegate
) {
308 return connection_
->SendStreamData(id
, iov
, offset
, fin
, fec_protection
,
309 ack_notifier_delegate
);
312 void QuicSession::SendRstStream(QuicStreamId id
,
313 QuicRstStreamErrorCode error
,
314 QuicStreamOffset bytes_written
) {
315 if (ContainsKey(static_stream_map_
, id
)) {
316 LOG(DFATAL
) << "Cannot send RST for a static stream with ID " << id
;
320 if (connection()->connected()) {
321 // Only send a RST_STREAM frame if still connected.
322 connection_
->SendRstStream(id
, error
, bytes_written
);
324 CloseStreamInner(id
, true);
327 void QuicSession::SendGoAway(QuicErrorCode error_code
, const string
& reason
) {
332 connection_
->SendGoAway(error_code
, largest_peer_created_stream_id_
, reason
);
335 void QuicSession::CloseStream(QuicStreamId stream_id
) {
336 CloseStreamInner(stream_id
, false);
339 void QuicSession::CloseStreamInner(QuicStreamId stream_id
,
340 bool locally_reset
) {
341 DVLOG(1) << ENDPOINT
<< "Closing stream " << stream_id
;
343 StreamMap::iterator it
= dynamic_stream_map_
.find(stream_id
);
344 if (it
== dynamic_stream_map_
.end()) {
345 // When CloseStreamInner has been called recursively (via
346 // ReliableQuicStream::OnClose), the stream will already have been deleted
347 // from stream_map_, so return immediately.
348 DVLOG(1) << ENDPOINT
<< "Stream is already closed: " << stream_id
;
351 ReliableQuicStream
* stream
= it
->second
;
353 // Tell the stream that a RST has been sent.
355 stream
->set_rst_sent(true);
358 closed_streams_
.push_back(it
->second
);
360 // If we haven't received a FIN or RST for this stream, we need to keep track
361 // of the how many bytes the stream's flow controller believes it has
362 // received, for accurate connection level flow control accounting.
363 if (!stream
->HasFinalReceivedByteOffset()) {
364 locally_closed_streams_highest_offset_
[stream_id
] =
365 stream
->flow_controller()->highest_received_byte_offset();
368 dynamic_stream_map_
.erase(it
);
369 draining_streams_
.erase(stream_id
);
371 // Decrease the number of streams being emulated when a new one is opened.
372 connection_
->SetNumOpenStreams(dynamic_stream_map_
.size());
375 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset(
376 QuicStreamId stream_id
, QuicStreamOffset final_byte_offset
) {
377 map
<QuicStreamId
, QuicStreamOffset
>::iterator it
=
378 locally_closed_streams_highest_offset_
.find(stream_id
);
379 if (it
== locally_closed_streams_highest_offset_
.end()) {
383 DVLOG(1) << ENDPOINT
<< "Received final byte offset " << final_byte_offset
384 << " for stream " << stream_id
;
385 QuicByteCount offset_diff
= final_byte_offset
- it
->second
;
386 if (flow_controller_
.UpdateHighestReceivedOffset(
387 flow_controller_
.highest_received_byte_offset() + offset_diff
)) {
388 // If the final offset violates flow control, close the connection now.
389 if (flow_controller_
.FlowControlViolation()) {
390 connection_
->SendConnectionClose(
391 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA
);
396 flow_controller_
.AddBytesConsumed(offset_diff
);
397 locally_closed_streams_highest_offset_
.erase(it
);
400 bool QuicSession::IsEncryptionEstablished() {
401 return GetCryptoStream()->encryption_established();
404 bool QuicSession::IsCryptoHandshakeConfirmed() {
405 return GetCryptoStream()->handshake_confirmed();
408 void QuicSession::OnConfigNegotiated() {
409 connection_
->SetFromConfig(config_
);
411 uint32 max_streams
= config_
.MaxStreamsPerConnection();
412 if (perspective() == Perspective::IS_SERVER
) {
413 // A server should accept a small number of additional streams beyond the
414 // limit sent to the client. This helps avoid early connection termination
415 // when FIN/RSTs for old streams are lost or arrive out of order.
416 // Use a minimum number of additional streams, or a percentage increase,
417 // whichever is larger.
419 max(max_streams
+ kMaxStreamsMinimumIncrement
,
420 static_cast<uint32
>(max_streams
* kMaxStreamsMultiplier
));
422 if (config_
.HasReceivedConnectionOptions()) {
423 if (ContainsQuicTag(config_
.ReceivedConnectionOptions(), kAFCW
)) {
424 EnableAutoTuneReceiveWindow();
426 // The following variations change the initial receive flow control window
427 // size for streams. For simplicity reasons, do not try to effect
428 // existing streams but only future ones.
429 if (ContainsQuicTag(config_
.ReceivedConnectionOptions(), kIFW5
)) {
430 config_
.SetInitialStreamFlowControlWindowToSend(32 * 1024);
432 if (ContainsQuicTag(config_
.ReceivedConnectionOptions(), kIFW6
)) {
433 config_
.SetInitialStreamFlowControlWindowToSend(64 * 1024);
435 if (ContainsQuicTag(config_
.ReceivedConnectionOptions(), kIFW7
)) {
436 config_
.SetInitialStreamFlowControlWindowToSend(128 * 1024);
440 set_max_open_streams(max_streams
);
442 if (config_
.HasReceivedInitialStreamFlowControlWindowBytes()) {
443 // Streams which were created before the SHLO was received (0-RTT
444 // requests) are now informed of the peer's initial flow control window.
445 OnNewStreamFlowControlWindow(
446 config_
.ReceivedInitialStreamFlowControlWindowBytes());
448 if (config_
.HasReceivedInitialSessionFlowControlWindowBytes()) {
449 OnNewSessionFlowControlWindow(
450 config_
.ReceivedInitialSessionFlowControlWindowBytes());
454 void QuicSession::EnableAutoTuneReceiveWindow() {
455 flow_controller_
.set_auto_tune_receive_window(true);
456 // Inform all existing streams about the new window.
457 for (auto const& kv
: static_stream_map_
) {
458 kv
.second
->flow_controller()->set_auto_tune_receive_window(true);
460 for (auto const& kv
: dynamic_stream_map_
) {
461 kv
.second
->flow_controller()->set_auto_tune_receive_window(true);
465 void QuicSession::OnNewStreamFlowControlWindow(QuicStreamOffset new_window
) {
466 if (new_window
< kMinimumFlowControlSendWindow
) {
467 LOG(ERROR
) << "Peer sent us an invalid stream flow control send window: "
469 << ", below default: " << kMinimumFlowControlSendWindow
;
470 if (connection_
->connected()) {
471 connection_
->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW
);
476 // Inform all existing streams about the new window.
477 for (auto const& kv
: static_stream_map_
) {
478 kv
.second
->UpdateSendWindowOffset(new_window
);
480 for (auto const& kv
: dynamic_stream_map_
) {
481 kv
.second
->UpdateSendWindowOffset(new_window
);
485 void QuicSession::OnNewSessionFlowControlWindow(QuicStreamOffset new_window
) {
486 if (new_window
< kMinimumFlowControlSendWindow
) {
487 LOG(ERROR
) << "Peer sent us an invalid session flow control send window: "
489 << ", below default: " << kMinimumFlowControlSendWindow
;
490 if (connection_
->connected()) {
491 connection_
->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW
);
496 flow_controller_
.UpdateSendWindowOffset(new_window
);
499 void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event
) {
501 // TODO(satyamshekhar): Move the logic of setting the encrypter/decrypter
502 // to QuicSession since it is the glue.
503 case ENCRYPTION_FIRST_ESTABLISHED
:
506 case ENCRYPTION_REESTABLISHED
:
507 // Retransmit originally packets that were sent, since they can't be
508 // decrypted by the peer.
509 connection_
->RetransmitUnackedPackets(ALL_INITIAL_RETRANSMISSION
);
512 case HANDSHAKE_CONFIRMED
:
513 LOG_IF(DFATAL
, !config_
.negotiated()) << ENDPOINT
514 << "Handshake confirmed without parameter negotiation.";
515 // Discard originally encrypted packets, since they can't be decrypted by
517 connection_
->NeuterUnencryptedPackets();
521 LOG(ERROR
) << ENDPOINT
<< "Got unknown handshake event: " << event
;
525 void QuicSession::OnCryptoHandshakeMessageSent(
526 const CryptoHandshakeMessage
& message
) {
529 void QuicSession::OnCryptoHandshakeMessageReceived(
530 const CryptoHandshakeMessage
& message
) {
533 QuicConfig
* QuicSession::config() {
537 void QuicSession::ActivateStream(ReliableQuicStream
* stream
) {
538 DVLOG(1) << ENDPOINT
<< "num_streams: " << dynamic_stream_map_
.size()
539 << ". activating " << stream
->id();
540 DCHECK(!ContainsKey(dynamic_stream_map_
, stream
->id()));
541 DCHECK(!ContainsKey(static_stream_map_
, stream
->id()));
542 dynamic_stream_map_
[stream
->id()] = stream
;
543 // Increase the number of streams being emulated when a new one is opened.
544 connection_
->SetNumOpenStreams(dynamic_stream_map_
.size());
547 QuicStreamId
QuicSession::GetNextStreamId() {
548 QuicStreamId id
= next_stream_id_
;
549 next_stream_id_
+= 2;
553 ReliableQuicStream
* QuicSession::GetStream(const QuicStreamId stream_id
) {
554 StreamMap::iterator it
= static_stream_map_
.find(stream_id
);
555 if (it
!= static_stream_map_
.end()) {
558 return GetDynamicStream(stream_id
);
561 void QuicSession::StreamDraining(QuicStreamId stream_id
) {
562 DCHECK(ContainsKey(dynamic_stream_map_
, stream_id
));
563 if (!ContainsKey(draining_streams_
, stream_id
)) {
564 draining_streams_
.insert(stream_id
);
568 ReliableQuicStream
* QuicSession::GetDynamicStream(
569 const QuicStreamId stream_id
) {
570 if (static_stream_map_
.find(stream_id
) != static_stream_map_
.end()) {
571 DLOG(FATAL
) << "Attempt to call GetDynamicStream for a static stream";
575 StreamMap::iterator it
= dynamic_stream_map_
.find(stream_id
);
576 if (it
!= dynamic_stream_map_
.end()) {
580 if (IsClosedStream(stream_id
)) {
584 if (stream_id
% 2 == next_stream_id_
% 2) {
585 // We've received a frame for a locally-created stream that is not
586 // currently active. This is an error.
587 if (connection()->connected()) {
588 connection()->SendConnectionClose(QUIC_PACKET_FOR_NONEXISTENT_STREAM
);
593 return GetIncomingDynamicStream(stream_id
);
596 ReliableQuicStream
* QuicSession::GetIncomingDynamicStream(
597 QuicStreamId stream_id
) {
598 if (IsClosedStream(stream_id
)) {
602 implicitly_created_streams_
.erase(stream_id
);
603 if (stream_id
> largest_peer_created_stream_id_
) {
604 if (stream_id
- largest_peer_created_stream_id_
> kMaxStreamIdDelta
) {
605 // We may already have sent a connection close due to multiple reset
606 // streams in the same packet.
607 if (connection()->connected()) {
608 LOG(ERROR
) << "Trying to get stream: " << stream_id
609 << ", largest peer created stream: "
610 << largest_peer_created_stream_id_
611 << ", max delta: " << kMaxStreamIdDelta
;
612 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID
);
616 for (QuicStreamId id
= largest_peer_created_stream_id_
+ 2;
619 implicitly_created_streams_
.insert(id
);
621 largest_peer_created_stream_id_
= stream_id
;
623 ReliableQuicStream
* stream
= CreateIncomingDynamicStream(stream_id
);
624 if (stream
== nullptr) {
627 ActivateStream(stream
);
631 void QuicSession::set_max_open_streams(size_t max_open_streams
) {
632 DVLOG(1) << "Setting max_open_streams_ to " << max_open_streams
;
633 max_open_streams_
= max_open_streams
;
636 bool QuicSession::IsClosedStream(QuicStreamId id
) {
638 if (ContainsKey(static_stream_map_
, id
) ||
639 ContainsKey(dynamic_stream_map_
, id
)) {
643 if (id
% 2 == next_stream_id_
% 2) {
644 // Locally created streams are strictly in-order. If the id is in the
645 // range of created streams and it's not active, it must have been closed.
646 return id
< next_stream_id_
;
648 // For peer created streams, we also need to consider implicitly created
650 return id
<= largest_peer_created_stream_id_
&&
651 !ContainsKey(implicitly_created_streams_
, id
);
654 size_t QuicSession::GetNumOpenStreams() const {
655 return dynamic_stream_map_
.size() + implicitly_created_streams_
.size() -
656 draining_streams_
.size();
659 void QuicSession::MarkConnectionLevelWriteBlocked(QuicStreamId id
,
660 QuicPriority priority
) {
662 ReliableQuicStream
* stream
= GetStream(id
);
663 if (stream
!= nullptr) {
664 LOG_IF(DFATAL
, priority
!= stream
->EffectivePriority())
665 << ENDPOINT
<< "Stream " << id
666 << "Priorities do not match. Got: " << priority
667 << " Expected: " << stream
->EffectivePriority();
669 LOG(DFATAL
) << "Marking unknown stream " << id
<< " blocked.";
673 if (id
== kCryptoStreamId
) {
674 DCHECK(!has_pending_handshake_
);
675 has_pending_handshake_
= true;
676 // TODO(jar): Be sure to use the highest priority for the crypto stream,
677 // perhaps by adding a "special" priority for it that is higher than
679 priority
= kHighestPriority
;
681 write_blocked_streams_
.PushBack(id
, priority
);
684 bool QuicSession::HasDataToWrite() const {
685 return write_blocked_streams_
.HasWriteBlockedCryptoOrHeadersStream() ||
686 write_blocked_streams_
.HasWriteBlockedDataStreams() ||
687 connection_
->HasQueuedData();
690 void QuicSession::PostProcessAfterData() {
691 STLDeleteElements(&closed_streams_
);
693 if (connection()->connected() &&
694 locally_closed_streams_highest_offset_
.size() > max_open_streams_
) {
695 // A buggy client may fail to send FIN/RSTs. Don't tolerate this.
696 connection_
->SendConnectionClose(QUIC_TOO_MANY_UNFINISHED_STREAMS
);
700 bool QuicSession::IsConnectionFlowControlBlocked() const {
701 return flow_controller_
.IsBlocked();
704 bool QuicSession::IsStreamFlowControlBlocked() {
705 for (auto const& kv
: static_stream_map_
) {
706 if (kv
.second
->flow_controller()->IsBlocked()) {
710 for (auto const& kv
: dynamic_stream_map_
) {
711 if (kv
.second
->flow_controller()->IsBlocked()) {