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. 4 5 // The base class for client/server QUIC streams. 6 7 // It does not contain the entire interface needed by an application to interact 8 // with a QUIC stream. Some parts of the interface must be obtained by 9 // accessing the owning session object. A subclass of QuicStream 10 // connects the object and the application that generates and consumes the data 11 // of the stream. 12 13 // The QuicStream object has a dependent QuicStreamSequencer object, 14 // which is given the stream frames as they arrive, and provides stream data in 15 // order by invoking ProcessRawData(). 16 17 #ifndef QUICHE_QUIC_CORE_QUIC_STREAM_H_ 18 #define QUICHE_QUIC_CORE_QUIC_STREAM_H_ 19 20 #include <cstddef> 21 #include <cstdint> 22 #include <list> 23 #include <optional> 24 #include <string> 25 26 #include "absl/strings/string_view.h" 27 #include "absl/types/span.h" 28 #include "quiche/quic/core/frames/quic_rst_stream_frame.h" 29 #include "quiche/quic/core/quic_error_codes.h" 30 #include "quiche/quic/core/quic_flow_controller.h" 31 #include "quiche/quic/core/quic_packets.h" 32 #include "quiche/quic/core/quic_stream_priority.h" 33 #include "quiche/quic/core/quic_stream_send_buffer.h" 34 #include "quiche/quic/core/quic_stream_sequencer.h" 35 #include "quiche/quic/core/quic_types.h" 36 #include "quiche/quic/core/session_notifier_interface.h" 37 #include "quiche/quic/core/stream_delegate_interface.h" 38 #include "quiche/quic/platform/api/quic_export.h" 39 #include "quiche/common/platform/api/quiche_mem_slice.h" 40 #include "quiche/common/platform/api/quiche_reference_counted.h" 41 #include "quiche/spdy/core/spdy_protocol.h" 42 43 namespace quic { 44 45 namespace test { 46 class QuicStreamPeer; 47 } // namespace test 48 49 class QuicSession; 50 class QuicStream; 51 52 // Buffers frames for a stream until the first byte of that frame arrives. 53 class QUICHE_EXPORT PendingStream 54 : public QuicStreamSequencer::StreamInterface { 55 public: 56 PendingStream(QuicStreamId id, QuicSession* session); 57 PendingStream(const PendingStream&) = delete; 58 PendingStream(PendingStream&&) = default; 59 ~PendingStream() override = default; 60 61 // QuicStreamSequencer::StreamInterface 62 void OnDataAvailable() override; 63 void OnFinRead() override; 64 void AddBytesConsumed(QuicByteCount bytes) override; 65 void ResetWithError(QuicResetStreamError error) override; 66 void OnUnrecoverableError(QuicErrorCode error, 67 const std::string& details) override; 68 void OnUnrecoverableError(QuicErrorCode error, 69 QuicIetfTransportErrorCodes ietf_error, 70 const std::string& details) override; 71 QuicStreamId id() const override; 72 ParsedQuicVersion version() const override; 73 74 // Buffers the contents of |frame|. Frame must have a non-zero offset. 75 // If the data violates flow control, the connection will be closed. 76 void OnStreamFrame(const QuicStreamFrame& frame); 77 is_bidirectional()78 bool is_bidirectional() const { return is_bidirectional_; } 79 80 // Stores the final byte offset from |frame|. 81 // If the final offset violates flow control, the connection will be closed. 82 void OnRstStreamFrame(const QuicRstStreamFrame& frame); 83 84 void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); 85 86 void OnStopSending(QuicResetStreamError stop_sending_error_code); 87 88 // The error code received from QuicStopSendingFrame (if any). GetStopSendingErrorCode()89 const std::optional<QuicResetStreamError>& GetStopSendingErrorCode() const { 90 return stop_sending_error_code_; 91 } 92 93 // Returns the number of bytes read on this stream. stream_bytes_read()94 uint64_t stream_bytes_read() { return stream_bytes_read_; } 95 sequencer()96 const QuicStreamSequencer* sequencer() const { return &sequencer_; } 97 98 void MarkConsumed(QuicByteCount num_bytes); 99 100 // Tells the sequencer to ignore all incoming data itself and not call 101 // OnDataAvailable(). 102 void StopReading(); 103 104 private: 105 friend class QuicStream; 106 107 bool MaybeIncreaseHighestReceivedOffset(QuicStreamOffset new_offset); 108 109 // ID of this stream. 110 QuicStreamId id_; 111 112 // QUIC version being used by this stream. 113 ParsedQuicVersion version_; 114 115 // |stream_delegate_| must outlive this stream. 116 StreamDelegateInterface* stream_delegate_; 117 118 // Bytes read refers to payload bytes only: they do not include framing, 119 // encryption overhead etc. 120 uint64_t stream_bytes_read_; 121 122 // True if a frame containing a fin has been received. 123 bool fin_received_; 124 125 // True if this pending stream is backing a bidirectional stream. 126 bool is_bidirectional_; 127 128 // Connection-level flow controller. Owned by the session. 129 QuicFlowController* connection_flow_controller_; 130 // Stream-level flow controller. 131 QuicFlowController flow_controller_; 132 // Stores the buffered frames. 133 QuicStreamSequencer sequencer_; 134 // The error code received from QuicStopSendingFrame (if any). 135 std::optional<QuicResetStreamError> stop_sending_error_code_; 136 }; 137 138 class QUICHE_EXPORT QuicStream : public QuicStreamSequencer::StreamInterface { 139 public: 140 // Creates a new stream with stream_id |id| associated with |session|. If 141 // |is_static| is true, then the stream will be given precedence 142 // over other streams when determing what streams should write next. 143 // |type| indicates whether the stream is bidirectional, read unidirectional 144 // or write unidirectional. 145 // TODO(fayang): Remove |type| when IETF stream ID numbering fully kicks in. 146 QuicStream(QuicStreamId id, QuicSession* session, bool is_static, 147 StreamType type); 148 QuicStream(PendingStream* pending, QuicSession* session, bool is_static); 149 QuicStream(const QuicStream&) = delete; 150 QuicStream& operator=(const QuicStream&) = delete; 151 152 virtual ~QuicStream(); 153 154 // QuicStreamSequencer::StreamInterface implementation. id()155 QuicStreamId id() const override { return id_; } 156 ParsedQuicVersion version() const override; 157 // Called by the stream subclass after it has consumed the final incoming 158 // data. 159 void OnFinRead() override; 160 161 // Called by the subclass or the sequencer to reset the stream from this 162 // end. 163 void ResetWithError(QuicResetStreamError error) override; 164 // Convenience wrapper for the method above. 165 // TODO(b/200606367): switch all calls to using QuicResetStreamError 166 // interface. 167 void Reset(QuicRstStreamErrorCode error); 168 169 // Reset() sends both RESET_STREAM and STOP_SENDING; the two methods below 170 // allow to send only one of those. 171 void ResetWriteSide(QuicResetStreamError error); 172 void SendStopSending(QuicResetStreamError error); 173 174 // Called by the subclass or the sequencer to close the entire connection from 175 // this end. 176 void OnUnrecoverableError(QuicErrorCode error, 177 const std::string& details) override; 178 void OnUnrecoverableError(QuicErrorCode error, 179 QuicIetfTransportErrorCodes ietf_error, 180 const std::string& details) override; 181 182 // Called by the session when a (potentially duplicate) stream frame has been 183 // received for this stream. 184 virtual void OnStreamFrame(const QuicStreamFrame& frame); 185 186 // Called by the session when the connection becomes writeable to allow the 187 // stream to write any pending data. 188 virtual void OnCanWrite(); 189 190 // Called by the session when the endpoint receives a RST_STREAM from the 191 // peer. 192 virtual void OnStreamReset(const QuicRstStreamFrame& frame); 193 194 // Called by the session when the endpoint receives or sends a connection 195 // close, and should immediately close the stream. 196 virtual void OnConnectionClosed(QuicErrorCode error, 197 ConnectionCloseSource source); 198 199 const QuicStreamPriority& priority() const; 200 201 // Send PRIORITY_UPDATE frame if application protocol supports it. MaybeSendPriorityUpdateFrame()202 virtual void MaybeSendPriorityUpdateFrame() {} 203 204 // Sets |priority_| to priority. This should only be called before bytes are 205 // written to the server. For a server stream, this is called when a 206 // PRIORITY_UPDATE frame is received. This calls 207 // MaybeSendPriorityUpdateFrame(), which for a client stream might send a 208 // PRIORITY_UPDATE frame. 209 void SetPriority(const QuicStreamPriority& priority); 210 211 // Returns true if this stream is still waiting for acks of sent data. 212 // This will return false if all data has been acked, or if the stream 213 // is no longer interested in data being acked (which happens when 214 // a stream is reset because of an error). 215 bool IsWaitingForAcks() const; 216 stream_error()217 QuicRstStreamErrorCode stream_error() const { 218 return stream_error_.internal_code(); 219 } connection_error()220 QuicErrorCode connection_error() const { return connection_error_; } 221 reading_stopped()222 bool reading_stopped() const { 223 return sequencer_.ignore_read_data() || read_side_closed_; 224 } write_side_closed()225 bool write_side_closed() const { return write_side_closed_; } read_side_closed()226 bool read_side_closed() const { return read_side_closed_; } 227 IsZombie()228 bool IsZombie() const { 229 return read_side_closed_ && write_side_closed_ && IsWaitingForAcks(); 230 } 231 rst_received()232 bool rst_received() const { return rst_received_; } rst_sent()233 bool rst_sent() const { return rst_sent_; } fin_received()234 bool fin_received() const { return fin_received_; } fin_sent()235 bool fin_sent() const { return fin_sent_; } fin_outstanding()236 bool fin_outstanding() const { return fin_outstanding_; } fin_lost()237 bool fin_lost() const { return fin_lost_; } 238 239 uint64_t BufferedDataBytes() const; 240 stream_bytes_read()241 uint64_t stream_bytes_read() const { return stream_bytes_read_; } 242 uint64_t stream_bytes_written() const; 243 busy_counter()244 size_t busy_counter() const { return busy_counter_; } set_busy_counter(size_t busy_counter)245 void set_busy_counter(size_t busy_counter) { busy_counter_ = busy_counter; } 246 247 // Adjust the flow control window according to new offset in |frame|. 248 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); 249 250 int num_frames_received() const; 251 int num_duplicate_frames_received() const; 252 253 // Flow controller related methods. 254 bool IsFlowControlBlocked() const; 255 QuicStreamOffset highest_received_byte_offset() const; 256 void UpdateReceiveWindowSize(QuicStreamOffset size); 257 258 // Called when endpoint receives a frame which could increase the highest 259 // offset. 260 // Returns true if the highest offset did increase. 261 bool MaybeIncreaseHighestReceivedOffset(QuicStreamOffset new_offset); 262 263 // Set the flow controller's send window offset from session config. 264 // |was_zero_rtt_rejected| is true if this config is from a rejected IETF QUIC 265 // 0-RTT attempt. Closes the connection and returns false if |new_offset| is 266 // not valid. 267 bool MaybeConfigSendWindowOffset(QuicStreamOffset new_offset, 268 bool was_zero_rtt_rejected); 269 270 // Returns true if the stream has received either a RST_STREAM or a FIN - 271 // either of which gives a definitive number of bytes which the peer has 272 // sent. If this is not true on deletion of the stream object, the session 273 // must keep track of the stream's byte offset until a definitive final value 274 // arrives. HasReceivedFinalOffset()275 bool HasReceivedFinalOffset() const { return fin_received_ || rst_received_; } 276 277 // Returns true if the stream has queued data waiting to write. 278 bool HasBufferedData() const; 279 280 // Returns the version of QUIC being used for this stream. 281 QuicTransportVersion transport_version() const; 282 283 // Returns the crypto handshake protocol that was used on this stream's 284 // connection. 285 HandshakeProtocol handshake_protocol() const; 286 287 // Sets the sequencer to consume all incoming data itself and not call 288 // OnDataAvailable(). 289 // When the FIN is received, the stream will be notified automatically (via 290 // OnFinRead()) (which may happen during the call of StopReading()). 291 // TODO(dworley): There should be machinery to send a RST_STREAM/NO_ERROR and 292 // stop sending stream-level flow-control updates when this end sends FIN. 293 virtual void StopReading(); 294 295 // Sends as much of |data| to the connection on the application encryption 296 // level as the connection will consume, and then buffers any remaining data 297 // in the send buffer. If fin is true: if it is immediately passed on to the 298 // session, write_side_closed() becomes true, otherwise fin_buffered_ becomes 299 // true. 300 void WriteOrBufferData( 301 absl::string_view data, bool fin, 302 quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface> 303 ack_listener); 304 305 // Sends |data| to connection with specified |level|. 306 void WriteOrBufferDataAtLevel( 307 absl::string_view data, bool fin, EncryptionLevel level, 308 quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface> 309 ack_listener); 310 311 // Adds random padding after the fin is consumed for this stream. 312 void AddRandomPaddingAfterFin(); 313 314 // Write |data_length| of data starts at |offset| from send buffer. 315 bool WriteStreamData(QuicStreamOffset offset, QuicByteCount data_length, 316 QuicDataWriter* writer); 317 318 // Called when data [offset, offset + data_length) is acked. |fin_acked| 319 // indicates whether the fin is acked. Returns true and updates 320 // |newly_acked_length| if any new stream data (including fin) gets acked. 321 virtual bool OnStreamFrameAcked(QuicStreamOffset offset, 322 QuicByteCount data_length, bool fin_acked, 323 QuicTime::Delta ack_delay_time, 324 QuicTime receive_timestamp, 325 QuicByteCount* newly_acked_length); 326 327 // Called when data [offset, offset + data_length) was retransmitted. 328 // |fin_retransmitted| indicates whether fin was retransmitted. 329 virtual void OnStreamFrameRetransmitted(QuicStreamOffset offset, 330 QuicByteCount data_length, 331 bool fin_retransmitted); 332 333 // Called when data [offset, offset + data_length) is considered as lost. 334 // |fin_lost| indicates whether the fin is considered as lost. 335 virtual void OnStreamFrameLost(QuicStreamOffset offset, 336 QuicByteCount data_length, bool fin_lost); 337 338 // Called to retransmit outstanding portion in data [offset, offset + 339 // data_length) and |fin| with Transmission |type|. 340 // Returns true if all data gets retransmitted. 341 virtual bool RetransmitStreamData(QuicStreamOffset offset, 342 QuicByteCount data_length, bool fin, 343 TransmissionType type); 344 345 // Sets deadline of this stream to be now + |ttl|, returns true if the setting 346 // succeeds. 347 bool MaybeSetTtl(QuicTime::Delta ttl); 348 349 // Commits data into the stream write buffer, and potentially sends it over 350 // the wire. This method has all-or-nothing semantics: if the write buffer is 351 // not full, all of the memslices in |span| are moved into it; otherwise, 352 // nothing happens. 353 QuicConsumedData WriteMemSlices(absl::Span<quiche::QuicheMemSlice> span, 354 bool fin); 355 QuicConsumedData WriteMemSlice(quiche::QuicheMemSlice span, bool fin); 356 357 // Returns true if any stream data is lost (including fin) and needs to be 358 // retransmitted. 359 virtual bool HasPendingRetransmission() const; 360 361 // Returns true if any portion of data [offset, offset + data_length) is 362 // outstanding or fin is outstanding (if |fin| is true). Returns false 363 // otherwise. 364 bool IsStreamFrameOutstanding(QuicStreamOffset offset, 365 QuicByteCount data_length, bool fin) const; 366 type()367 StreamType type() const { return type_; } 368 369 // Handle received StopSending frame. Returns true if the processing finishes 370 // gracefully. 371 virtual bool OnStopSending(QuicResetStreamError error); 372 373 // Returns true if the stream is static. is_static()374 bool is_static() const { return is_static_; } 375 was_draining()376 bool was_draining() const { return was_draining_; } 377 creation_time()378 QuicTime creation_time() const { return creation_time_; } 379 fin_buffered()380 bool fin_buffered() const { return fin_buffered_; } 381 382 // True if buffered data in send buffer is below buffered_data_threshold_. 383 bool CanWriteNewData() const; 384 385 // Called immediately after the stream is created from a pending stream, 386 // indicating it can start processing data. 387 void OnStreamCreatedFromPendingStream(); 388 DisableConnectionFlowControlForThisStream()389 void DisableConnectionFlowControlForThisStream() { 390 stream_contributes_to_connection_flow_control_ = false; 391 } 392 393 // Returns the min of stream level flow control window size and connection 394 // level flow control window size. 395 QuicByteCount CalculateSendWindowSize() const; 396 397 protected: 398 // Called when data of [offset, offset + data_length] is buffered in send 399 // buffer. OnDataBuffered(QuicStreamOffset,QuicByteCount,const quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface> &)400 virtual void OnDataBuffered( 401 QuicStreamOffset /*offset*/, QuicByteCount /*data_length*/, 402 const quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface>& 403 /*ack_listener*/) {} 404 405 // Called just before the object is destroyed. 406 // The object should not be accessed after OnClose is called. 407 // Sends a RST_STREAM with code QUIC_RST_ACKNOWLEDGEMENT if neither a FIN nor 408 // a RST_STREAM has been sent. 409 virtual void OnClose(); 410 411 // True if buffered data in send buffer is still below 412 // buffered_data_threshold_ even after writing |length| bytes. 413 bool CanWriteNewDataAfterData(QuicByteCount length) const; 414 415 // Called when upper layer can write new data. OnCanWriteNewData()416 virtual void OnCanWriteNewData() {} 417 418 // Called when |bytes_consumed| bytes has been consumed. 419 virtual void OnStreamDataConsumed(QuicByteCount bytes_consumed); 420 421 // Called by the stream sequencer as bytes are consumed from the buffer. 422 // If the receive window has dropped below the threshold, then send a 423 // WINDOW_UPDATE frame. 424 void AddBytesConsumed(QuicByteCount bytes) override; 425 426 // Writes pending retransmissions if any. 427 virtual void WritePendingRetransmission(); 428 429 // This is called when stream tries to retransmit data after deadline_. Make 430 // this virtual so that subclasses can implement their own logics. 431 virtual void OnDeadlinePassed(); 432 433 // Called to set fin_sent_. This is only used by Google QUIC while body is 434 // empty. 435 void SetFinSent(); 436 437 // Send STOP_SENDING if it hasn't been sent yet. 438 void MaybeSendStopSending(QuicResetStreamError error); 439 440 // Send RESET_STREAM if it hasn't been sent yet. 441 void MaybeSendRstStream(QuicResetStreamError error); 442 443 // Convenience wrappers for two methods above. MaybeSendRstStream(QuicRstStreamErrorCode error)444 void MaybeSendRstStream(QuicRstStreamErrorCode error) { 445 MaybeSendRstStream(QuicResetStreamError::FromInternal(error)); 446 } MaybeSendStopSending(QuicRstStreamErrorCode error)447 void MaybeSendStopSending(QuicRstStreamErrorCode error) { 448 MaybeSendStopSending(QuicResetStreamError::FromInternal(error)); 449 } 450 451 // Close the read side of the stream. May cause the stream to be closed. 452 virtual void CloseReadSide(); 453 454 // Close the write side of the socket. Further writes will fail. 455 // Can be called by the subclass or internally. 456 // Does not send a FIN. May cause the stream to be closed. 457 virtual void CloseWriteSide(); 458 set_rst_received(bool rst_received)459 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } set_stream_error(QuicResetStreamError error)460 void set_stream_error(QuicResetStreamError error) { stream_error_ = error; } 461 stream_delegate()462 StreamDelegateInterface* stream_delegate() { return stream_delegate_; } 463 session()464 const QuicSession* session() const { return session_; } session()465 QuicSession* session() { return session_; } 466 sequencer()467 const QuicStreamSequencer* sequencer() const { return &sequencer_; } sequencer()468 QuicStreamSequencer* sequencer() { return &sequencer_; } 469 470 const QuicIntervalSet<QuicStreamOffset>& bytes_acked() const; 471 send_buffer()472 const QuicStreamSendBuffer& send_buffer() const { return send_buffer_; } 473 send_buffer()474 QuicStreamSendBuffer& send_buffer() { return send_buffer_; } 475 476 // Called when the write side of the stream is closed, and all of the outgoing 477 // data has been acknowledged. This corresponds to the "Data Recvd" state of 478 // RFC 9000. OnWriteSideInDataRecvdState()479 virtual void OnWriteSideInDataRecvdState() {} 480 481 // Return the current stream-level flow control send window in bytes. 482 std::optional<QuicByteCount> GetSendWindow() const; 483 std::optional<QuicByteCount> GetReceiveWindow() const; 484 485 private: 486 friend class test::QuicStreamPeer; 487 friend class QuicStreamUtils; 488 489 QuicStream(QuicStreamId id, QuicSession* session, 490 QuicStreamSequencer sequencer, bool is_static, StreamType type, 491 uint64_t stream_bytes_read, bool fin_received, 492 std::optional<QuicFlowController> flow_controller, 493 QuicFlowController* connection_flow_controller); 494 495 // Calls MaybeSendBlocked on the stream's flow controller and the connection 496 // level flow controller. If the stream is flow control blocked by the 497 // connection-level flow controller but not by the stream-level flow 498 // controller, marks this stream as connection-level write blocked. 499 void MaybeSendBlocked(); 500 501 // Write buffered data (in send buffer) at |level|. 502 void WriteBufferedData(EncryptionLevel level); 503 504 // Called when bytes are sent to the peer. 505 void AddBytesSent(QuicByteCount bytes); 506 507 // Returns true if deadline_ has passed. 508 bool HasDeadlinePassed() const; 509 510 QuicStreamSequencer sequencer_; 511 QuicStreamId id_; 512 // Pointer to the owning QuicSession object. 513 // TODO(b/136274541): Remove session pointer from streams. 514 QuicSession* session_; 515 StreamDelegateInterface* stream_delegate_; 516 // The priority of the stream, once parsed. 517 QuicStreamPriority priority_; 518 // Bytes read refers to payload bytes only: they do not include framing, 519 // encryption overhead etc. 520 uint64_t stream_bytes_read_; 521 522 // Stream error code received from a RstStreamFrame or error code sent by the 523 // visitor or sequencer in the RstStreamFrame. 524 QuicResetStreamError stream_error_; 525 // Connection error code due to which the stream was closed. |stream_error_| 526 // is set to |QUIC_STREAM_CONNECTION_ERROR| when this happens and consumers 527 // should check |connection_error_|. 528 QuicErrorCode connection_error_; 529 530 // True if the read side is closed and further frames should be rejected. 531 bool read_side_closed_; 532 // True if the write side is closed, and further writes should fail. 533 bool write_side_closed_; 534 535 // True if OnWriteSideInDataRecvdState() has already been called. 536 bool write_side_data_recvd_state_notified_; 537 538 // True if the subclass has written a FIN with WriteOrBufferData, but it was 539 // buffered in queued_data_ rather than being sent to the session. 540 bool fin_buffered_; 541 // True if a FIN has been sent to the session. 542 bool fin_sent_; 543 // True if a FIN is waiting to be acked. 544 bool fin_outstanding_; 545 // True if a FIN is lost. 546 bool fin_lost_; 547 548 // True if this stream has received (and the sequencer has accepted) a 549 // StreamFrame with the FIN set. 550 bool fin_received_; 551 552 // True if an RST_STREAM has been sent to the session. 553 // In combination with fin_sent_, used to ensure that a FIN and/or a 554 // RST_STREAM is always sent to terminate the stream. 555 bool rst_sent_; 556 557 // True if this stream has received a RST_STREAM frame. 558 bool rst_received_; 559 560 // True if the stream has sent STOP_SENDING to the session. 561 bool stop_sending_sent_; 562 563 std::optional<QuicFlowController> flow_controller_; 564 565 // The connection level flow controller. Not owned. 566 QuicFlowController* connection_flow_controller_; 567 568 // Special streams, such as the crypto and headers streams, do not respect 569 // connection level flow control limits (but are stream level flow control 570 // limited). 571 bool stream_contributes_to_connection_flow_control_; 572 573 // A counter incremented when OnCanWrite() is called and no progress is made. 574 // For debugging only. 575 size_t busy_counter_; 576 577 // Indicates whether paddings will be added after the fin is consumed for this 578 // stream. 579 bool add_random_padding_after_fin_; 580 581 // Send buffer of this stream. Send buffer is cleaned up when data gets acked 582 // or discarded. 583 QuicStreamSendBuffer send_buffer_; 584 585 // Latched value of quic_buffered_data_threshold. 586 const QuicByteCount buffered_data_threshold_; 587 588 // If true, then this stream has precedence over other streams for write 589 // scheduling. 590 const bool is_static_; 591 592 // If initialized, reset this stream at this deadline. 593 QuicTime deadline_; 594 595 // True if this stream has entered draining state. 596 bool was_draining_; 597 598 // Indicates whether this stream is bidirectional, read unidirectional or 599 // write unidirectional. 600 const StreamType type_; 601 602 // Creation time of this stream, as reported by the QuicClock. 603 const QuicTime creation_time_; 604 605 Perspective perspective_; 606 }; 607 608 } // namespace quic 609 610 #endif // QUICHE_QUIC_CORE_QUIC_STREAM_H_ 611