mirror of https://github.com/infosecn1nja/C3.git
LinterOverlapped fix review comments
parent
20172dcf49
commit
8cf356c1a3
|
@ -195,19 +195,15 @@ namespace FSecure::C3::Linter
|
|||
|
||||
for (auto noProgressCounter = 0; noProgressCounter < 10; ++noProgressCounter)
|
||||
{
|
||||
if (!sender.IsDone())
|
||||
if (sender.Send())
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue