diff --git a/libraries/networking/src/udt/PacketList.cpp b/libraries/networking/src/udt/PacketList.cpp index 53edfb32f1..64ae8f54db 100644 --- a/libraries/networking/src/udt/PacketList.cpp +++ b/libraries/networking/src/udt/PacketList.cpp @@ -105,7 +105,7 @@ std::unique_ptr PacketList::createPacketWithExtendedHeader() { } void PacketList::closeCurrentPacket(bool shouldSendEmpty) { - if (shouldSendEmpty && !_currentPacket) { + if (shouldSendEmpty && !_currentPacket && _packets.empty()) { _currentPacket = createPacketWithExtendedHeader(); } diff --git a/tools/udt-test/src/UDTTest.cpp b/tools/udt-test/src/UDTTest.cpp index d57ff7a874..32ab1780e0 100644 --- a/tools/udt-test/src/UDTTest.cpp +++ b/tools/udt-test/src/UDTTest.cpp @@ -282,7 +282,7 @@ void UDTTest::sendPacket() { packetList->write(randomPaddedData); } - packetList->closeCurrentPacket(false); + packetList->closeCurrentPacket(); _totalQueuedBytes += packetList->getDataSize(); _totalQueuedPackets += packetList->getNumPackets();