diff --git a/tests/ecaludp_test/src/ecaludp_socket_test.cpp b/tests/ecaludp_test/src/ecaludp_socket_test.cpp index 71506cc..c9ec9f1 100644 --- a/tests/ecaludp_test/src/ecaludp_socket_test.cpp +++ b/tests/ecaludp_test/src/ecaludp_socket_test.cpp @@ -120,6 +120,14 @@ TEST(EcalUdpSocket, AsyncBigMessage) ASSERT_EQ(ec, asio::error_code()); } + // Set a big receive buffer size, so we will not lose fragments + { + asio::error_code ec; + socket.set_option(asio::socket_base::receive_buffer_size(1024 * 1024 * 5), ec); + ASSERT_FALSE(ec); + } + + auto work = std::make_unique(io_context); std::thread io_thread([&io_context]() { io_context.run(); }); @@ -202,7 +210,7 @@ TEST(EcalUdpSocket, CancelSyncReceive) }); // Wait 10 milliseconds to make sure that the receiver is ready - std::this_thread::sleep_for(std::chrono::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); // Cancel the receive { @@ -221,7 +229,6 @@ TEST(EcalUdpSocket, CancelSyncReceive) rcv_thread.join(); } - // Send and Receive a small Hello World message using the sync API TEST(EcalUdpSocket, SyncHelloWorldMessage) { @@ -329,6 +336,13 @@ TEST(EcalUdpSocket, SyncBigMessage) rcv_socket.bind(asio::ip::udp::endpoint(asio::ip::address_v4::loopback(), 14000), ec); ASSERT_FALSE(ec); } + + // Set a big receive buffer size, so we will not lose fragments + { + asio::error_code ec; + rcv_socket.set_option(asio::socket_base::receive_buffer_size(1024 * 1024 * 5), ec); + ASSERT_FALSE(ec); + } asio::ip::udp::endpoint sender_endpoint;