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 <string> 24 25 #include "absl/strings/string_view.h" 26 #include "absl/types/optional.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 QUIC_EXPORT_PRIVATE 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 absl::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 absl::optional<QuicResetStreamError> stop_sending_error_code_; 136 }; 137 138 class QUIC_EXPORT_PRIVATE QuicStream 139 : public QuicStreamSequencer::StreamInterface { 140 public: 141 // Creates a new stream with stream_id |id| associated with |session|. If 142 // |is_static| is true, then the stream will be given precedence 143 // over other streams when determing what streams should write next. 144 // |type| indicates whether the stream is bidirectional, read unidirectional 145 // or write unidirectional. 146 // TODO(fayang): Remove |type| when IETF stream ID numbering fully kicks in. 147 QuicStream(QuicStreamId id, QuicSession* session, bool is_static, 148 StreamType type); 149 QuicStream(PendingStream* pending, QuicSession* session, bool is_static); 150 QuicStream(const QuicStream&) = delete; 151 QuicStream& operator=(const QuicStream&) = delete; 152 153 virtual ~QuicStream(); 154 155 // QuicStreamSequencer::StreamInterface implementation. id()156 QuicStreamId id() const override { return id_; } 157 ParsedQuicVersion version() const override; 158 // Called by the stream subclass after it has consumed the final incoming 159 // data. 160 void OnFinRead() override; 161 162 // Called by the subclass or the sequencer to reset the stream from this 163 // end. 164 void ResetWithError(QuicResetStreamError error) override; 165 // Convenience wrapper for the method above. 166 // TODO(b/200606367): switch all calls to using QuicResetStreamError 167 // interface. 168 void Reset(QuicRstStreamErrorCode error); 169 170 // Reset() sends both RESET_STREAM and STOP_SENDING; the two methods below 171 // allow to send only one of those. 172 void ResetWriteSide(QuicResetStreamError error); 173 void SendStopSending(QuicResetStreamError error); 174 175 // Called by the subclass or the sequencer to close the entire connection from 176 // this end. 177 void OnUnrecoverableError(QuicErrorCode error, 178 const std::string& details) override; 179 void OnUnrecoverableError(QuicErrorCode error, 180 QuicIetfTransportErrorCodes ietf_error, 181 const std::string& details) override; 182 183 // Called by the session when a (potentially duplicate) stream frame has been 184 // received for this stream. 185 virtual void OnStreamFrame(const QuicStreamFrame& frame); 186 187 // Called by the session when the connection becomes writeable to allow the 188 // stream to write any pending data. 189 virtual void OnCanWrite(); 190 191 // Called by the session when the endpoint receives a RST_STREAM from the 192 // peer. 193 virtual void OnStreamReset(const QuicRstStreamFrame& frame); 194 195 // Called by the session when the endpoint receives or sends a connection 196 // close, and should immediately close the stream. 197 virtual void OnConnectionClosed(QuicErrorCode error, 198 ConnectionCloseSource source); 199 200 const QuicStreamPriority& priority() const; 201 202 // Send PRIORITY_UPDATE frame if application protocol supports it. MaybeSendPriorityUpdateFrame()203 virtual void MaybeSendPriorityUpdateFrame() {} 204 205 // Sets |priority_| to priority. This should only be called before bytes are 206 // written to the server. For a server stream, this is called when a 207 // PRIORITY_UPDATE frame is received. This calls 208 // MaybeSendPriorityUpdateFrame(), which for a client stream might send a 209 // PRIORITY_UPDATE frame. 210 void SetPriority(const QuicStreamPriority& priority); 211 212 // Returns true if this stream is still waiting for acks of sent data. 213 // This will return false if all data has been acked, or if the stream 214 // is no longer interested in data being acked (which happens when 215 // a stream is reset because of an error). 216 bool IsWaitingForAcks() const; 217 218 // Number of bytes available to read. 219 QuicByteCount ReadableBytes() const; 220 stream_error()221 QuicRstStreamErrorCode stream_error() const { 222 return stream_error_.internal_code(); 223 } connection_error()224 QuicErrorCode connection_error() const { return connection_error_; } 225 reading_stopped()226 bool reading_stopped() const { 227 return sequencer_.ignore_read_data() || read_side_closed_; 228 } write_side_closed()229 bool write_side_closed() const { return write_side_closed_; } read_side_closed()230 bool read_side_closed() const { return read_side_closed_; } 231 IsZombie()232 bool IsZombie() const { 233 return read_side_closed_ && write_side_closed_ && IsWaitingForAcks(); 234 } 235 rst_received()236 bool rst_received() const { return rst_received_; } rst_sent()237 bool rst_sent() const { return rst_sent_; } fin_received()238 bool fin_received() const { return fin_received_; } fin_sent()239 bool fin_sent() const { return fin_sent_; } fin_outstanding()240 bool fin_outstanding() const { return fin_outstanding_; } fin_lost()241 bool fin_lost() const { return fin_lost_; } 242 243 uint64_t BufferedDataBytes() const; 244 stream_bytes_read()245 uint64_t stream_bytes_read() const { return stream_bytes_read_; } 246 uint64_t stream_bytes_written() const; 247 busy_counter()248 size_t busy_counter() const { return busy_counter_; } set_busy_counter(size_t busy_counter)249 void set_busy_counter(size_t busy_counter) { busy_counter_ = busy_counter; } 250 251 // Adjust the flow control window according to new offset in |frame|. 252 virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame); 253 254 int num_frames_received() const; 255 int num_duplicate_frames_received() const; 256 257 // Flow controller related methods. 258 bool IsFlowControlBlocked() const; 259 QuicStreamOffset highest_received_byte_offset() const; 260 void UpdateReceiveWindowSize(QuicStreamOffset size); 261 262 // Called when endpoint receives a frame which could increase the highest 263 // offset. 264 // Returns true if the highest offset did increase. 265 bool MaybeIncreaseHighestReceivedOffset(QuicStreamOffset new_offset); 266 267 // Set the flow controller's send window offset from session config. 268 // |was_zero_rtt_rejected| is true if this config is from a rejected IETF QUIC 269 // 0-RTT attempt. Closes the connection and returns false if |new_offset| is 270 // not valid. 271 bool MaybeConfigSendWindowOffset(QuicStreamOffset new_offset, 272 bool was_zero_rtt_rejected); 273 274 // Returns true if the stream has received either a RST_STREAM or a FIN - 275 // either of which gives a definitive number of bytes which the peer has 276 // sent. If this is not true on deletion of the stream object, the session 277 // must keep track of the stream's byte offset until a definitive final value 278 // arrives. HasReceivedFinalOffset()279 bool HasReceivedFinalOffset() const { return fin_received_ || rst_received_; } 280 281 // Returns true if the stream has queued data waiting to write. 282 bool HasBufferedData() const; 283 284 // Returns the version of QUIC being used for this stream. 285 QuicTransportVersion transport_version() const; 286 287 // Returns the crypto handshake protocol that was used on this stream's 288 // connection. 289 HandshakeProtocol handshake_protocol() const; 290 291 // Sets the sequencer to consume all incoming data itself and not call 292 // OnDataAvailable(). 293 // When the FIN is received, the stream will be notified automatically (via 294 // OnFinRead()) (which may happen during the call of StopReading()). 295 // TODO(dworley): There should be machinery to send a RST_STREAM/NO_ERROR and 296 // stop sending stream-level flow-control updates when this end sends FIN. 297 virtual void StopReading(); 298 299 // Sends as much of |data| to the connection on the application encryption 300 // level as the connection will consume, and then buffers any remaining data 301 // in the send buffer. If fin is true: if it is immediately passed on to the 302 // session, write_side_closed() becomes true, otherwise fin_buffered_ becomes 303 // true. 304 void WriteOrBufferData( 305 absl::string_view data, bool fin, 306 quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface> 307 ack_listener); 308 309 // Sends |data| to connection with specified |level|. 310 void WriteOrBufferDataAtLevel( 311 absl::string_view data, bool fin, EncryptionLevel level, 312 quiche::QuicheReferenceCountedPointer<QuicAckListenerInterface> 313 ack_listener); 314 315 // Adds random padding after the fin is consumed for this stream. 316 void AddRandomPaddingAfterFin(); 317 318 // Write |data_length| of data starts at |offset| from send buffer. 319 bool WriteStreamData(QuicStreamOffset offset, QuicByteCount data_length, 320 QuicDataWriter* writer); 321 322 // Called when data [offset, offset + data_length) is acked. |fin_acked| 323 // indicates whether the fin is acked. Returns true and updates 324 // |newly_acked_length| if any new stream data (including fin) gets acked. 325 virtual bool OnStreamFrameAcked(QuicStreamOffset offset, 326 QuicByteCount data_length, bool fin_acked, 327 QuicTime::Delta ack_delay_time, 328 QuicTime receive_timestamp, 329 QuicByteCount* newly_acked_length); 330 331 // Called when data [offset, offset + data_length) was retransmitted. 332 // |fin_retransmitted| indicates whether fin was retransmitted. 333 virtual void OnStreamFrameRetransmitted(QuicStreamOffset offset, 334 QuicByteCount data_length, 335 bool fin_retransmitted); 336 337 // Called when data [offset, offset + data_length) is considered as lost. 338 // |fin_lost| indicates whether the fin is considered as lost. 339 virtual void OnStreamFrameLost(QuicStreamOffset offset, 340 QuicByteCount data_length, bool fin_lost); 341 342 // Called to retransmit outstanding portion in data [offset, offset + 343 // data_length) and |fin| with Transmission |type|. 344 // Returns true if all data gets retransmitted. 345 virtual bool RetransmitStreamData(QuicStreamOffset offset, 346 QuicByteCount data_length, bool fin, 347 TransmissionType type); 348 349 // Sets deadline of this stream to be now + |ttl|, returns true if the setting 350 // succeeds. 351 bool MaybeSetTtl(QuicTime::Delta ttl); 352 353 // Commits data into the stream write buffer, and potentially sends it over 354 // the wire. This method has all-or-nothing semantics: if the write buffer is 355 // not full, all of the memslices in |span| are moved into it; otherwise, 356 // nothing happens. 357 QuicConsumedData WriteMemSlices(absl::Span<quiche::QuicheMemSlice> span, 358 bool fin); 359 QuicConsumedData WriteMemSlice(quiche::QuicheMemSlice span, bool fin); 360 361 // Returns true if any stream data is lost (including fin) and needs to be 362 // retransmitted. 363 virtual bool HasPendingRetransmission() const; 364 365 // Returns true if any portion of data [offset, offset + data_length) is 366 // outstanding or fin is outstanding (if |fin| is true). Returns false 367 // otherwise. 368 bool IsStreamFrameOutstanding(QuicStreamOffset offset, 369 QuicByteCount data_length, bool fin) const; 370 type()371 StreamType type() const { return type_; } 372 373 // Handle received StopSending frame. Returns true if the processing finishes 374 // gracefully. 375 virtual bool OnStopSending(QuicResetStreamError error); 376 377 // Returns true if the stream is static. is_static()378 bool is_static() const { return is_static_; } 379 was_draining()380 bool was_draining() const { return was_draining_; } 381 creation_time()382 QuicTime creation_time() const { return creation_time_; } 383 fin_buffered()384 bool fin_buffered() const { return fin_buffered_; } 385 386 // True if buffered data in send buffer is below buffered_data_threshold_. 387 bool CanWriteNewData() const; 388 389 // Called immediately after the stream is created from a pending stream, 390 // indicating it can start processing data. 391 void OnStreamCreatedFromPendingStream(); 392 DisableConnectionFlowControlForThisStream()393 void DisableConnectionFlowControlForThisStream() { 394 stream_contributes_to_connection_flow_control_ = false; 395 } 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 warppers 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 write side of the socket. Further writes will fail. 452 // Can be called by the subclass or internally. 453 // Does not send a FIN. May cause the stream to be closed. 454 virtual void CloseWriteSide(); 455 set_rst_received(bool rst_received)456 void set_rst_received(bool rst_received) { rst_received_ = rst_received; } set_stream_error(QuicResetStreamError error)457 void set_stream_error(QuicResetStreamError error) { stream_error_ = error; } 458 stream_delegate()459 StreamDelegateInterface* stream_delegate() { return stream_delegate_; } 460 session()461 const QuicSession* session() const { return session_; } session()462 QuicSession* session() { return session_; } 463 sequencer()464 const QuicStreamSequencer* sequencer() const { return &sequencer_; } sequencer()465 QuicStreamSequencer* sequencer() { return &sequencer_; } 466 467 const QuicIntervalSet<QuicStreamOffset>& bytes_acked() const; 468 send_buffer()469 const QuicStreamSendBuffer& send_buffer() const { return send_buffer_; } 470 send_buffer()471 QuicStreamSendBuffer& send_buffer() { return send_buffer_; } 472 473 // Called when the write side of the stream is closed, and all of the outgoing 474 // data has been acknowledged. This corresponds to the "Data Recvd" state of 475 // RFC 9000. OnWriteSideInDataRecvdState()476 virtual void OnWriteSideInDataRecvdState() {} 477 478 // Return the current flow control send window in bytes. 479 absl::optional<QuicByteCount> GetSendWindow() const; 480 absl::optional<QuicByteCount> GetReceiveWindow() const; 481 482 private: 483 friend class test::QuicStreamPeer; 484 friend class QuicStreamUtils; 485 486 QuicStream(QuicStreamId id, QuicSession* session, 487 QuicStreamSequencer sequencer, bool is_static, StreamType type, 488 uint64_t stream_bytes_read, bool fin_received, 489 absl::optional<QuicFlowController> flow_controller, 490 QuicFlowController* connection_flow_controller); 491 492 // Calls MaybeSendBlocked on the stream's flow controller and the connection 493 // level flow controller. If the stream is flow control blocked by the 494 // connection-level flow controller but not by the stream-level flow 495 // controller, marks this stream as connection-level write blocked. 496 void MaybeSendBlocked(); 497 498 // Write buffered data (in send buffer) at |level|. 499 void WriteBufferedData(EncryptionLevel level); 500 501 // Close the read side of the stream. May cause the stream to be closed. 502 void CloseReadSide(); 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 absl::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