Skip to content

Commit e1b389c

Browse files
Right variable name
Signed-off-by: Eugenio Collado <eugeniocollado@eprosima.com>
1 parent dd9e88d commit e1b389c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

ddsenabler/examples/service/main.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
CLIParser::example_config config;
3939
bool service_discovered_ = false;
4040
uint32_t received_replies_ = 0;
41+
uint32_t sent_replies_ = 0;
4142
std::vector<std::pair<uint64_t, std::string>> received_requests_;
4243
std::mutex app_mutex_;
4344
std::condition_variable app_cv_;
@@ -355,7 +356,7 @@ bool server_specific_logic(
355356
const std::string& request,
356357
uint64_t request_id)
357358
{
358-
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // Simulate processing time
359+
std::this_thread::sleep_for(std::chrono::milliseconds(200)); // Simulate processing time
359360
std::string json = "{\"sum\": 3}"; // Example response, replace with actual logic
360361
if (!enabler->send_service_reply(service_name, json, request_id))
361362
{
@@ -403,8 +404,10 @@ bool server_routine(
403404
// Check if we have received the expected number of requests
404405
{
405406
std::lock_guard<std::mutex> lock(app_mutex_);
406-
if (++received_replies_ >= expected_requests)
407+
if (++sent_replies_ >= expected_requests)
407408
{
409+
// Wait to ensure the last sent reply reaches destination
410+
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
408411
return true;
409412
}
410413
}

0 commit comments

Comments
 (0)