LinterOverlapped fix review comments

master
Pawel Kurowski 2020-08-31 13:20:01 +02:00
parent 20172dcf49
commit 8cf356c1a3
3 changed files with 7 additions and 20 deletions

View File

@ -195,18 +195,14 @@ namespace FSecure::C3::Linter
for (auto noProgressCounter = 0; noProgressCounter < 10; ++noProgressCounter)
{
if (!sender.IsDone())
if (sender.Send())
noProgressCounter = 0;
if (!sender.IsDone() && sender.Send())
noProgressCounter = 0;
if (receiver.Receive())
noProgressCounter = 0;
if (receiver.Size())
{
auto packets = receiver.GetPackets();
if (auto && packets = receiver.GetPackets(); !packets.empty())
return ByteView{ packets[0] } == data;
}
}
return false;

View File

@ -113,8 +113,8 @@ namespace FSecure::C3::Linter
if (receiver.Receive())
noProgressCounter = 0;
if (receiver.Size() >= minExpectedSize)
return receiver.GetPackets();
if (auto && packets = receiver.GetPackets(); packets.size() >= minExpectedSize)
return packets;
}
throw std::runtime_error("Cannot receive data");
@ -122,12 +122,12 @@ namespace FSecure::C3::Linter
FSecure::C3::Linter::MockDeviceBridge::ChunkSender MockDeviceBridge::GetChunkSender(ByteView blob)
{
return { *m_Device.get(), m_QoS, blob };
return { *m_Device, m_QoS, blob };
}
FSecure::C3::Linter::MockDeviceBridge::ChunkReceiver MockDeviceBridge::GetChunkReceiver()
{
return { *m_Device.get(), m_QoS };
return { *m_Device, m_QoS };
}
MockDeviceBridge::ChunkSender::ChunkSender(Device& device, QualityOfService& qos, ByteView blob)
@ -170,11 +170,6 @@ namespace FSecure::C3::Linter
return ret;
}
size_t MockDeviceBridge::ChunkReceiver::Size()
{
return m_Packets.size();
}
std::vector<FSecure::ByteVector> const& MockDeviceBridge::ChunkReceiver::GetPackets()
{
return m_Packets;

View File

@ -118,10 +118,6 @@ namespace FSecure::C3::Linter
/// @return true if at least one valid chunk was received.
bool Receive();
/// Number of merged complete packets.
/// @return packet count.
size_t Size();
/// Get all packets.
/// Packet sequential number is not used for reordering.
/// Packets are returned in same order, as were available for merging from chunks.