diff --git a/slsSupportLib/include/UdpRxSocket.h b/slsSupportLib/include/UdpRxSocket.h index e9013148d..483405565 100644 --- a/slsSupportLib/include/UdpRxSocket.h +++ b/slsSupportLib/include/UdpRxSocket.h @@ -90,18 +90,13 @@ class UdpRxSocket { } const char *LastPacket() const noexcept { return buff; } - //constexpr - ssize_t getPacketSize() const noexcept { return packet_size; } - - bool ReceivePacket() noexcept { - auto bytes_received = - recvfrom(fd, buff, packet_size, 0, nullptr, nullptr); - return bytes_received == packet_size; - } + ssize_t getPacketSize() const noexcept { return packet_size; } + + bool ReceivePacket() noexcept { return ReceivePacket(buff); } bool ReceivePacket(char *dst) noexcept { auto bytes_received = - recvfrom(fd, buff, packet_size, 0, nullptr, nullptr); + recvfrom(fd, dst, packet_size, 0, nullptr, nullptr); return bytes_received == packet_size; } diff --git a/slsSupportLib/tests/test-UdpRxSocket.cpp b/slsSupportLib/tests/test-UdpRxSocket.cpp index 027369714..830f71c64 100644 --- a/slsSupportLib/tests/test-UdpRxSocket.cpp +++ b/slsSupportLib/tests/test-UdpRxSocket.cpp @@ -70,7 +70,7 @@ TEST_CASE("Shutdown socket without hanging when waiting for data") { &sls::UdpRxSocket::ReceivePacket), &s); - //s.Close(); Commented out by Dhanya (TODO!) + s.Shutdown(); auto r = ret.get(); CHECK(r == false); // since we didn't get the packet