| 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 #include "net/quic/quic_connection.h" | 5 #include "net/quic/quic_connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 | 1504 |
| 1505 // Re-packetize the frames with a new packet number for retransmission. | 1505 // Re-packetize the frames with a new packet number for retransmission. |
| 1506 // Retransmitted data packets do not use FEC, even when it's enabled. | 1506 // Retransmitted data packets do not use FEC, even when it's enabled. |
| 1507 // Retransmitted packets use the same packet number length as the | 1507 // Retransmitted packets use the same packet number length as the |
| 1508 // original. | 1508 // original. |
| 1509 // Flush the packet generator before making a new packet. | 1509 // Flush the packet generator before making a new packet. |
| 1510 // TODO(ianswett): Implement ReserializeAllFrames as a separate path that | 1510 // TODO(ianswett): Implement ReserializeAllFrames as a separate path that |
| 1511 // does not require the creator to be flushed. | 1511 // does not require the creator to be flushed. |
| 1512 packet_generator_.FlushAllQueuedFrames(); | 1512 packet_generator_.FlushAllQueuedFrames(); |
| 1513 char buffer[kMaxPacketSize]; | 1513 char buffer[kMaxPacketSize]; |
| 1514 SerializedPacket serialized_packet = | 1514 packet_generator_.ReserializeAllFrames(pending, buffer, kMaxPacketSize); |
| 1515 packet_generator_.ReserializeAllFrames(pending, buffer, kMaxPacketSize); | |
| 1516 if (FLAGS_quic_retransmit_via_onserializedpacket) { | |
| 1517 DCHECK(serialized_packet.encrypted_buffer == nullptr); | |
| 1518 continue; | |
| 1519 } | |
| 1520 if (serialized_packet.encrypted_buffer == nullptr) { | |
| 1521 // We failed to serialize the packet, so close the connection. | |
| 1522 // CloseConnection does not send close packet, so no infinite loop here. | |
| 1523 // TODO(ianswett): This is actually an internal error, not an encryption | |
| 1524 // failure. | |
| 1525 CloseConnection(QUIC_ENCRYPTION_FAILURE, | |
| 1526 ConnectionCloseSource::FROM_SELF); | |
| 1527 return; | |
| 1528 } | |
| 1529 | |
| 1530 DVLOG(1) << ENDPOINT << "Retransmitting " << pending.packet_number << " as " | |
| 1531 << serialized_packet.packet_number; | |
| 1532 serialized_packet.original_packet_number = pending.packet_number; | |
| 1533 serialized_packet.transmission_type = pending.transmission_type; | |
| 1534 SendOrQueuePacket(&serialized_packet); | |
| 1535 } | 1515 } |
| 1536 } | 1516 } |
| 1537 | 1517 |
| 1538 void QuicConnection::RetransmitUnackedPackets( | 1518 void QuicConnection::RetransmitUnackedPackets( |
| 1539 TransmissionType retransmission_type) { | 1519 TransmissionType retransmission_type) { |
| 1540 sent_packet_manager_.RetransmitUnackedPackets(retransmission_type); | 1520 sent_packet_manager_.RetransmitUnackedPackets(retransmission_type); |
| 1541 | 1521 |
| 1542 WriteIfNotBlocked(); | 1522 WriteIfNotBlocked(); |
| 1543 } | 1523 } |
| 1544 | 1524 |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2531 void QuicConnection::OnPathClosed(QuicPathId path_id) { | 2511 void QuicConnection::OnPathClosed(QuicPathId path_id) { |
| 2532 // Stop receiving packets on this path. | 2512 // Stop receiving packets on this path. |
| 2533 framer_.OnPathClosed(path_id); | 2513 framer_.OnPathClosed(path_id); |
| 2534 } | 2514 } |
| 2535 | 2515 |
| 2536 bool QuicConnection::ack_frame_updated() const { | 2516 bool QuicConnection::ack_frame_updated() const { |
| 2537 return received_packet_manager_.ack_frame_updated(); | 2517 return received_packet_manager_.ack_frame_updated(); |
| 2538 } | 2518 } |
| 2539 | 2519 |
| 2540 } // namespace net | 2520 } // namespace net |
| OLD | NEW |