merge resolved

This commit is contained in:
maliakal_d 2020-02-25 15:48:41 +01:00
commit 5e6a3b7e3d
2 changed files with 5 additions and 10 deletions

View File

@ -90,18 +90,13 @@ class UdpRxSocket {
} }
const char *LastPacket() const noexcept { return buff; } const char *LastPacket() const noexcept { return buff; }
//constexpr ssize_t getPacketSize() const noexcept { return packet_size; }
ssize_t getPacketSize() const noexcept { return packet_size; }
bool ReceivePacket() noexcept { return ReceivePacket(buff); }
bool ReceivePacket() noexcept {
auto bytes_received =
recvfrom(fd, buff, packet_size, 0, nullptr, nullptr);
return bytes_received == packet_size;
}
bool ReceivePacket(char *dst) noexcept { bool ReceivePacket(char *dst) noexcept {
auto bytes_received = auto bytes_received =
recvfrom(fd, buff, packet_size, 0, nullptr, nullptr); recvfrom(fd, dst, packet_size, 0, nullptr, nullptr);
return bytes_received == packet_size; return bytes_received == packet_size;
} }

View File

@ -70,7 +70,7 @@ TEST_CASE("Shutdown socket without hanging when waiting for data") {
&sls::UdpRxSocket::ReceivePacket), &sls::UdpRxSocket::ReceivePacket),
&s); &s);
//s.Close(); Commented out by Dhanya (TODO!) s.Shutdown();
auto r = ret.get(); auto r = ret.get();
CHECK(r == false); // since we didn't get the packet CHECK(r == false); // since we didn't get the packet