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 <ostream> | 7 #include <ostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 451 } |
452 | 452 |
453 void SendPacket(EncryptionLevel level, | 453 void SendPacket(EncryptionLevel level, |
454 QuicPathId path_id, | 454 QuicPathId path_id, |
455 QuicPacketNumber packet_number, | 455 QuicPacketNumber packet_number, |
456 QuicPacket* packet, | 456 QuicPacket* packet, |
457 QuicPacketEntropyHash entropy_hash, | 457 QuicPacketEntropyHash entropy_hash, |
458 HasRetransmittableData retransmittable, | 458 HasRetransmittableData retransmittable, |
459 bool has_ack, | 459 bool has_ack, |
460 bool has_pending_frames) { | 460 bool has_pending_frames) { |
461 QuicFrames* retransmittable_frames = | |
462 retransmittable == HAS_RETRANSMITTABLE_DATA ? new QuicFrames() | |
463 : nullptr; | |
464 char buffer[kMaxPacketSize]; | 461 char buffer[kMaxPacketSize]; |
465 size_t encrypted_length = | 462 size_t encrypted_length = |
466 QuicConnectionPeer::GetFramer(this)->EncryptPayload( | 463 QuicConnectionPeer::GetFramer(this)->EncryptPayload( |
467 ENCRYPTION_NONE, path_id, packet_number, *packet, buffer, | 464 ENCRYPTION_NONE, path_id, packet_number, *packet, buffer, |
468 kMaxPacketSize); | 465 kMaxPacketSize); |
469 delete packet; | 466 delete packet; |
470 SerializedPacket serialized_packet( | 467 SerializedPacket serialized_packet( |
471 kDefaultPathId, packet_number, PACKET_6BYTE_PACKET_NUMBER, | 468 kDefaultPathId, packet_number, PACKET_6BYTE_PACKET_NUMBER, |
472 new QuicEncryptedPacket(buffer, encrypted_length, false), entropy_hash, | 469 new QuicEncryptedPacket(buffer, encrypted_length, false), entropy_hash, |
473 retransmittable_frames, has_ack, has_pending_frames); | 470 has_ack, has_pending_frames); |
| 471 if (retransmittable == HAS_RETRANSMITTABLE_DATA) { |
| 472 serialized_packet.retransmittable_frames.push_back( |
| 473 QuicFrame(new QuicStreamFrame())); |
| 474 } |
474 OnSerializedPacket(&serialized_packet); | 475 OnSerializedPacket(&serialized_packet); |
475 } | 476 } |
476 | 477 |
477 QuicConsumedData SendStreamDataWithString( | 478 QuicConsumedData SendStreamDataWithString( |
478 QuicStreamId id, | 479 QuicStreamId id, |
479 StringPiece data, | 480 StringPiece data, |
480 QuicStreamOffset offset, | 481 QuicStreamOffset offset, |
481 bool fin, | 482 bool fin, |
482 QuicAckListenerInterface* listener) { | 483 QuicAckListenerInterface* listener) { |
483 return SendStreamDataWithStringHelper(id, data, offset, fin, | 484 return SendStreamDataWithStringHelper(id, data, offset, fin, |
(...skipping 5021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5505 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); | 5506 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); |
5506 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), | 5507 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), |
5507 "Received a packet with multipath flag on when multipath is " | 5508 "Received a packet with multipath flag on when multipath is " |
5508 "not enabled."); | 5509 "not enabled."); |
5509 EXPECT_FALSE(connection_.connected()); | 5510 EXPECT_FALSE(connection_.connected()); |
5510 } | 5511 } |
5511 | 5512 |
5512 } // namespace | 5513 } // namespace |
5513 } // namespace test | 5514 } // namespace test |
5514 } // namespace net | 5515 } // namespace net |
OLD | NEW |