Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Foo committed Mar 31, 2024
1 parent 19179ef commit c6564ab
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/TestTCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ TEST_CASE("Establish tcp connection non blocking", "[tcp]") {
},
[&](Barrier &br) {
br.arrive_and_wait();
TcpClient<true> client{ Address{port, family} };
TcpClient<true> client{Address{port, family}};
client.open();
REQUIRE(client.wasOpened());
client.send(request);
Expand All @@ -299,7 +299,7 @@ TEST_CASE("Receive non blocking (tcp)", "[tcp]") {
const auto family = GENERATE(AddressFamily::IP_V4, AddressFamily::IP_V6);

std::optional<tcp::TcpConnectionNonBlocking> server_side;
tcp::TcpClient<false> client_side{ Address{port, family} };
tcp::TcpClient<false> client_side{Address{port, family}};
ParallelSection::biSection(
[&](Barrier &br) {
tcp::TcpServer<true> server{port, family};
Expand All @@ -316,13 +316,19 @@ TEST_CASE("Receive non blocking (tcp)", "[tcp]") {
SECTION("client side non blocking receive") {
CHECK(client_side.receive(request.size()).empty());
server_side->send(request);
#if defined(__APPLE__)
std::this_thread::sleep_for(std::chrono::seconds{3});
#endif
auto received_request = client_side.receive(request.size());
CHECK(received_request == request);
}

SECTION("server side non blocking receive") {
CHECK(server_side->receive(request.size()).empty());
client_side.send(request);
#if defined(__APPLE__)
std::this_thread::sleep_for(std::chrono::seconds{3});
#endif
auto received_request = server_side->receive(request.size());
CHECK(received_request == request);
}
Expand Down

0 comments on commit c6564ab

Please sign in to comment.