| 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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 | 705 |
| 706 // Writes the given packet to socket, encrypted with packet's | 706 // Writes the given packet to socket, encrypted with packet's |
| 707 // encryption_level. Returns true on successful write, and false if the writer | 707 // encryption_level. Returns true on successful write, and false if the writer |
| 708 // was blocked and the write needs to be tried again. Notifies the | 708 // was blocked and the write needs to be tried again. Notifies the |
| 709 // SentPacketManager when the write is successful and sets | 709 // SentPacketManager when the write is successful and sets |
| 710 // retransmittable frames to nullptr. | 710 // retransmittable frames to nullptr. |
| 711 // Saves the connection close packet for later transmission, even if the | 711 // Saves the connection close packet for later transmission, even if the |
| 712 // writer is write blocked. | 712 // writer is write blocked. |
| 713 bool WritePacket(SerializedPacket* packet); | 713 bool WritePacket(SerializedPacket* packet); |
| 714 | 714 |
| 715 // Does the main work of WritePacket, but does not delete the packet or | |
| 716 // retransmittable frames upon success. | |
| 717 bool WritePacketInner(SerializedPacket* packet); | |
| 718 | |
| 719 // Make sure an ack we got from our peer is sane. | 715 // Make sure an ack we got from our peer is sane. |
| 720 // Returns nullptr for valid acks or an error std::string if it was invalid. | 716 // Returns nullptr for valid acks or an error std::string if it was invalid. |
| 721 const char* ValidateAckFrame(const QuicAckFrame& incoming_ack); | 717 const char* ValidateAckFrame(const QuicAckFrame& incoming_ack); |
| 722 | 718 |
| 723 // Make sure a stop waiting we got from our peer is sane. | 719 // Make sure a stop waiting we got from our peer is sane. |
| 724 // Returns nullptr if the frame is valid or an error std::string if it was | 720 // Returns nullptr if the frame is valid or an error std::string if it was |
| 725 // invalid. | 721 // invalid. |
| 726 const char* ValidateStopWaitingFrame( | 722 const char* ValidateStopWaitingFrame( |
| 727 const QuicStopWaitingFrame& stop_waiting); | 723 const QuicStopWaitingFrame& stop_waiting); |
| 728 | 724 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 std::deque<QuicEncryptedPacket*> undecryptable_packets_; | 871 std::deque<QuicEncryptedPacket*> undecryptable_packets_; |
| 876 | 872 |
| 877 // Maximum number of undecryptable packets the connection will store. | 873 // Maximum number of undecryptable packets the connection will store. |
| 878 size_t max_undecryptable_packets_; | 874 size_t max_undecryptable_packets_; |
| 879 | 875 |
| 880 // When the version negotiation packet could not be sent because the socket | 876 // When the version negotiation packet could not be sent because the socket |
| 881 // was not writable, this is set to true. | 877 // was not writable, this is set to true. |
| 882 bool pending_version_negotiation_packet_; | 878 bool pending_version_negotiation_packet_; |
| 883 | 879 |
| 884 // When packets could not be sent because the socket was not writable, | 880 // When packets could not be sent because the socket was not writable, |
| 885 // they are added to this list. All corresponding frames are in | 881 // they are added to this std::list. All corresponding frames are in |
| 886 // unacked_packets_ if they are to be retransmitted. | 882 // unacked_packets_ if they are to be retransmitted. Packets encrypted_buffer |
| 883 // fields are owned by the QueuedPacketList, in order to ensure they outlast |
| 884 // the original scope of the SerializedPacket. |
| 887 QueuedPacketList queued_packets_; | 885 QueuedPacketList queued_packets_; |
| 888 | 886 |
| 889 // If true, then crypto packets will be saved as termination packets. | 887 // If true, then crypto packets will be saved as termination packets. |
| 890 bool save_crypto_packets_as_termination_packets_; | 888 bool save_crypto_packets_as_termination_packets_; |
| 891 | 889 |
| 892 // Contains the connection close packets if the connection has been closed. | 890 // Contains the connection close packets if the connection has been closed. |
| 893 scoped_ptr<std::vector<QuicEncryptedPacket*>> termination_packets_; | 891 scoped_ptr<std::vector<QuicEncryptedPacket*>> termination_packets_; |
| 894 | 892 |
| 895 // When true, the connection does not send a close packet on idle timeout due | 893 // When true, the connection does not send a close packet on idle timeout due |
| 896 // to lack of network activity. | 894 // to lack of network activity. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1040 | 1038 |
| 1041 // If true, multipath is enabled for this connection. | 1039 // If true, multipath is enabled for this connection. |
| 1042 bool multipath_enabled_; | 1040 bool multipath_enabled_; |
| 1043 | 1041 |
| 1044 DISALLOW_COPY_AND_ASSIGN(QuicConnection); | 1042 DISALLOW_COPY_AND_ASSIGN(QuicConnection); |
| 1045 }; | 1043 }; |
| 1046 | 1044 |
| 1047 } // namespace net | 1045 } // namespace net |
| 1048 | 1046 |
| 1049 #endif // NET_QUIC_QUIC_CONNECTION_H_ | 1047 #endif // NET_QUIC_QUIC_CONNECTION_H_ |
| OLD | NEW |