| 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 // The entity that handles framing writes for a Quic client or server. | 5 // The entity that handles framing writes for a Quic client or server. |
| 6 // Each QuicSession will have a connection associated with it. | 6 // Each QuicSession will have a connection associated with it. |
| 7 // | 7 // |
| 8 // On the server side, the Dispatcher handles the raw reads, and hands off | 8 // On the server side, the Dispatcher handles the raw reads, and hands off |
| 9 // packets via ProcessUdpPacket for framing and processing. | 9 // packets via ProcessUdpPacket for framing and processing. |
| 10 // | 10 // |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 const CachedNetworkParameters& cached_network_params, | 337 const CachedNetworkParameters& cached_network_params, |
| 338 bool max_bandwidth_resumption); | 338 bool max_bandwidth_resumption); |
| 339 | 339 |
| 340 // Sets the number of active streams on the connection for congestion control. | 340 // Sets the number of active streams on the connection for congestion control. |
| 341 void SetNumOpenStreams(size_t num_streams); | 341 void SetNumOpenStreams(size_t num_streams); |
| 342 | 342 |
| 343 // Send the data in |data| to the peer in as few packets as possible. | 343 // Send the data in |data| to the peer in as few packets as possible. |
| 344 // Returns a pair with the number of bytes consumed from data, and a boolean | 344 // Returns a pair with the number of bytes consumed from data, and a boolean |
| 345 // indicating if the fin bit was consumed. This does not indicate the data | 345 // indicating if the fin bit was consumed. This does not indicate the data |
| 346 // has been sent on the wire: it may have been turned into a packet and queued | 346 // has been sent on the wire: it may have been turned into a packet and queued |
| 347 // if the socket was unexpectedly blocked. |fec_protection| indicates if | 347 // if the socket was unexpectedly blocked. |
| 348 // data is to be FEC protected. Note that data that is sent immediately | |
| 349 // following MUST_FEC_PROTECT data may get protected by falling within the | |
| 350 // same FEC group. | |
| 351 // If |listener| is provided, then it will be informed once ACKs have been | 348 // If |listener| is provided, then it will be informed once ACKs have been |
| 352 // received for all the packets written in this call. | 349 // received for all the packets written in this call. |
| 353 // The |listener| is not owned by the QuicConnection and must outlive it. | 350 // The |listener| is not owned by the QuicConnection and must outlive it. |
| 354 virtual QuicConsumedData SendStreamData(QuicStreamId id, | 351 virtual QuicConsumedData SendStreamData(QuicStreamId id, |
| 355 QuicIOVector iov, | 352 QuicIOVector iov, |
| 356 QuicStreamOffset offset, | 353 QuicStreamOffset offset, |
| 357 bool fin, | 354 bool fin, |
| 358 FecProtection fec_protection, | |
| 359 QuicAckListenerInterface* listener); | 355 QuicAckListenerInterface* listener); |
| 360 | 356 |
| 361 // Send a RST_STREAM frame to the peer. | 357 // Send a RST_STREAM frame to the peer. |
| 362 virtual void SendRstStream(QuicStreamId id, | 358 virtual void SendRstStream(QuicStreamId id, |
| 363 QuicRstStreamErrorCode error, | 359 QuicRstStreamErrorCode error, |
| 364 QuicStreamOffset bytes_written); | 360 QuicStreamOffset bytes_written); |
| 365 | 361 |
| 366 // Send a BLOCKED frame to the peer. | 362 // Send a BLOCKED frame to the peer. |
| 367 virtual void SendBlocked(QuicStreamId id); | 363 virtual void SendBlocked(QuicStreamId id); |
| 368 | 364 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // QuicPacketGenerator::DelegateInterface | 465 // QuicPacketGenerator::DelegateInterface |
| 470 bool ShouldGeneratePacket(HasRetransmittableData retransmittable, | 466 bool ShouldGeneratePacket(HasRetransmittableData retransmittable, |
| 471 IsHandshake handshake) override; | 467 IsHandshake handshake) override; |
| 472 void PopulateAckFrame(QuicAckFrame* ack) override; | 468 void PopulateAckFrame(QuicAckFrame* ack) override; |
| 473 void PopulateStopWaitingFrame(QuicStopWaitingFrame* stop_waiting) override; | 469 void PopulateStopWaitingFrame(QuicStopWaitingFrame* stop_waiting) override; |
| 474 | 470 |
| 475 // QuicPacketCreator::DelegateInterface | 471 // QuicPacketCreator::DelegateInterface |
| 476 void OnSerializedPacket(SerializedPacket* packet) override; | 472 void OnSerializedPacket(SerializedPacket* packet) override; |
| 477 void OnUnrecoverableError(QuicErrorCode error, | 473 void OnUnrecoverableError(QuicErrorCode error, |
| 478 ConnectionCloseSource source) override; | 474 ConnectionCloseSource source) override; |
| 479 void OnResetFecGroup() override; | |
| 480 | 475 |
| 481 // QuicSentPacketManager::NetworkChangeVisitor | 476 // QuicSentPacketManager::NetworkChangeVisitor |
| 482 void OnCongestionWindowChange() override; | 477 void OnCongestionWindowChange() override; |
| 483 void OnRttChange() override; | 478 void OnRttChange() override; |
| 484 void OnPathDegrading() override; | 479 void OnPathDegrading() override; |
| 485 | 480 |
| 486 // Called by the crypto stream when the handshake completes. In the server's | 481 // Called by the crypto stream when the handshake completes. In the server's |
| 487 // case this is when the SHLO has been ACKed. Clients call this on receipt of | 482 // case this is when the SHLO has been ACKed. Clients call this on receipt of |
| 488 // the SHLO. | 483 // the SHLO. |
| 489 void OnHandshakeComplete(); | 484 void OnHandshakeComplete(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 // Sends a ping frame. | 549 // Sends a ping frame. |
| 555 void SendPing(); | 550 void SendPing(); |
| 556 | 551 |
| 557 // Sets up a packet with an QuicAckFrame and sends it out. | 552 // Sets up a packet with an QuicAckFrame and sends it out. |
| 558 void SendAck(); | 553 void SendAck(); |
| 559 | 554 |
| 560 // Called when an RTO fires. Resets the retransmission alarm if there are | 555 // Called when an RTO fires. Resets the retransmission alarm if there are |
| 561 // remaining unacked packets. | 556 // remaining unacked packets. |
| 562 void OnRetransmissionTimeout(); | 557 void OnRetransmissionTimeout(); |
| 563 | 558 |
| 564 // Called when a data packet is sent. Starts an alarm if the data sent in | |
| 565 // |packet_number| was FEC protected. | |
| 566 void MaybeSetFecAlarm(QuicPacketNumber packet_number); | |
| 567 | |
| 568 // Retransmits all unacked packets with retransmittable frames if | 559 // Retransmits all unacked packets with retransmittable frames if |
| 569 // |retransmission_type| is ALL_UNACKED_PACKETS, otherwise retransmits only | 560 // |retransmission_type| is ALL_UNACKED_PACKETS, otherwise retransmits only |
| 570 // initially encrypted packets. Used when the negotiated protocol version is | 561 // initially encrypted packets. Used when the negotiated protocol version is |
| 571 // different from what was initially assumed and when the initial encryption | 562 // different from what was initially assumed and when the initial encryption |
| 572 // changes. | 563 // changes. |
| 573 void RetransmitUnackedPackets(TransmissionType retransmission_type); | 564 void RetransmitUnackedPackets(TransmissionType retransmission_type); |
| 574 | 565 |
| 575 // Calls |sent_packet_manager_|'s NeuterUnencryptedPackets. Used when the | 566 // Calls |sent_packet_manager_|'s NeuterUnencryptedPackets. Used when the |
| 576 // connection becomes forward secure and hasn't received acks for all packets. | 567 // connection becomes forward secure and hasn't received acks for all packets. |
| 577 void NeuterUnencryptedPackets(); | 568 void NeuterUnencryptedPackets(); |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 QuicArenaScopedPtr<QuicAlarm> ping_alarm_; | 962 QuicArenaScopedPtr<QuicAlarm> ping_alarm_; |
| 972 // An alarm that fires when an MTU probe should be sent. | 963 // An alarm that fires when an MTU probe should be sent. |
| 973 QuicArenaScopedPtr<QuicAlarm> mtu_discovery_alarm_; | 964 QuicArenaScopedPtr<QuicAlarm> mtu_discovery_alarm_; |
| 974 | 965 |
| 975 // Neither visitor is owned by this class. | 966 // Neither visitor is owned by this class. |
| 976 QuicConnectionVisitorInterface* visitor_; | 967 QuicConnectionVisitorInterface* visitor_; |
| 977 QuicConnectionDebugVisitor* debug_visitor_; | 968 QuicConnectionDebugVisitor* debug_visitor_; |
| 978 | 969 |
| 979 QuicPacketGenerator packet_generator_; | 970 QuicPacketGenerator packet_generator_; |
| 980 | 971 |
| 981 // An alarm that fires when an FEC packet should be sent. | |
| 982 QuicArenaScopedPtr<QuicAlarm> fec_alarm_; | |
| 983 | |
| 984 // Network idle time before this connection is closed. | 972 // Network idle time before this connection is closed. |
| 985 QuicTime::Delta idle_network_timeout_; | 973 QuicTime::Delta idle_network_timeout_; |
| 986 // The connection will wait this long for the handshake to complete. | 974 // The connection will wait this long for the handshake to complete. |
| 987 QuicTime::Delta handshake_timeout_; | 975 QuicTime::Delta handshake_timeout_; |
| 988 | 976 |
| 989 // Statistics for this session. | 977 // Statistics for this session. |
| 990 QuicConnectionStats stats_; | 978 QuicConnectionStats stats_; |
| 991 | 979 |
| 992 // The time that we got a packet for this connection. | 980 // The time that we got a packet for this connection. |
| 993 // This is used for timeouts, and does not indicate the packet was processed. | 981 // This is used for timeouts, and does not indicate the packet was processed. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 | 1060 |
| 1073 // If true, multipath is enabled for this connection. | 1061 // If true, multipath is enabled for this connection. |
| 1074 bool multipath_enabled_; | 1062 bool multipath_enabled_; |
| 1075 | 1063 |
| 1076 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 1064 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 1077 }; | 1065 }; |
| 1078 | 1066 |
| 1079 } // namespace net | 1067 } // namespace net |
| 1080 | 1068 |
| 1081 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 1069 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |