Skip to content

Commit

Permalink
Refs #20589: Readapt test
Browse files Browse the repository at this point in the history
Signed-off-by: Jesus Perez <jesusperez@eprosima.com>
  • Loading branch information
jepemi committed Mar 5, 2024
1 parent 5aa3aca commit 371a955
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 8 additions & 2 deletions test/unittest/transport/TCPv4Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1523,11 +1523,14 @@ TEST_F(TCPv4Tests, secure_non_blocking_send)

// Send the message with no header. Since TCP actually allocates twice the size of the buffer requested
// and we want to guarantee that the buffer might be full, we send the message more than twice.
size_t bytes_sent = 0;
for (int i = 0; i < 5; i++)
{
sender_channel_resource->send(nullptr, 0, data, size, ec);
bytes_sent += sender_channel_resource->send(nullptr, 0, data, size, ec);
}

ASSERT_EQ(bytes_sent, size * 2);

secure_socket->lowest_layer().close(ec);
}
#endif // ifndef _WIN32
Expand Down Expand Up @@ -2022,11 +2025,14 @@ TEST_F(TCPv4Tests, non_blocking_send)

// Send the message with no header. Since TCP actually allocates twice the size of the buffer requested
// and we want to guarantee that the buffer might be full, we send the message more than twice.
size_t bytes_sent = 0;
for (int i = 0; i < 5; i++)
{
sender_channel_resource->send(nullptr, 0, data, size, ec);
bytes_sent += sender_channel_resource->send(nullptr, 0, data, size, ec);
}

ASSERT_EQ(bytes_sent, size * 2);

socket.shutdown(asio::ip::tcp::socket::shutdown_both);
socket.cancel();
socket.close();
Expand Down
5 changes: 4 additions & 1 deletion test/unittest/transport/TCPv6Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,14 @@ TEST_F(TCPv6Tests, non_blocking_send)

// Send the message with no header. Since TCP actually allocates twice the size of the buffer requested
// and we want to guarantee that the buffer might be full, we send the message more than twice.
size_t bytes_sent = 0;
for (int i = 0; i < 5; i++)
{
sender_channel_resource->send(nullptr, 0, data, size, ec);
bytes_sent += sender_channel_resource->send(nullptr, 0, data, size, ec);
}

ASSERT_EQ(bytes_sent, size * 2);

socket.shutdown(asio::ip::tcp::socket::shutdown_both);
socket.cancel();
socket.close();
Expand Down

0 comments on commit 371a955

Please sign in to comment.