@@ -36,6 +36,8 @@ namespace fastdds {
36
36
namespace rtps {
37
37
namespace ddb {
38
38
39
+ using ParticipantState = DiscoveryParticipantsAckStatus::ParticipantState;
40
+
39
41
DiscoveryDataBase::DiscoveryDataBase (
40
42
fastrtps::rtps::GuidPrefix_t server_guid_prefix,
41
43
std::set<fastrtps::rtps::GuidPrefix_t> servers)
@@ -267,8 +269,8 @@ void DiscoveryDataBase::update_change_and_unmatch_(
267
269
changes_to_release_.push_back (entity.update_and_unmatch (new_change));
268
270
// Manually set relevant participants ACK status of this server, and of the participant that sent the
269
271
// change, to 1. This way, we avoid backprogation of the data.
270
- entity.add_or_update_ack_participant (server_guid_prefix_, true );
271
- entity.add_or_update_ack_participant (new_change->writerGUID .guidPrefix , true );
272
+ entity.add_or_update_ack_participant (server_guid_prefix_, ParticipantState::ACKED );
273
+ entity.add_or_update_ack_participant (new_change->writerGUID .guidPrefix , ParticipantState::ACKED );
272
274
}
273
275
274
276
void DiscoveryDataBase::add_ack_ (
@@ -292,7 +294,7 @@ void DiscoveryDataBase::add_ack_(
292
294
// database has been updated, so this ACK is not relevant anymore
293
295
if (it->second .change ()->write_params .sample_identity () == change->write_params .sample_identity ())
294
296
{
295
- it->second .add_or_update_ack_participant (acked_entity, true );
297
+ it->second .add_or_update_ack_participant (acked_entity, ParticipantState::ACKED );
296
298
}
297
299
}
298
300
}
@@ -307,7 +309,7 @@ void DiscoveryDataBase::add_ack_(
307
309
// database has been updated, so this ACK is not relevant anymore
308
310
if (it->second .change ()->write_params .sample_identity () == change->write_params .sample_identity ())
309
311
{
310
- it->second .add_or_update_ack_participant (acked_entity, true );
312
+ it->second .add_or_update_ack_participant (acked_entity, ParticipantState::ACKED );
311
313
}
312
314
}
313
315
}
@@ -322,7 +324,7 @@ void DiscoveryDataBase::add_ack_(
322
324
// database has been updated, so this ACK is not relevant anymore
323
325
if (it->second .change ()->write_params .sample_identity () == change->write_params .sample_identity ())
324
326
{
325
- it->second .add_or_update_ack_participant (acked_entity, true );
327
+ it->second .add_or_update_ack_participant (acked_entity, ParticipantState::ACKED );
326
328
}
327
329
}
328
330
}
@@ -694,7 +696,7 @@ void DiscoveryDataBase::create_new_participant_from_change_(
694
696
695
697
// Manually set to 1 the relevant participants ACK status of the participant that sent the change. This way,
696
698
// we avoid backprogation of the data.
697
- ret.first ->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , true );
699
+ ret.first ->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , ParticipantState::ACKED );
698
700
699
701
// If the DATA(p) it's from this server, it is already in history and we do nothing here
700
702
if (change_guid.guidPrefix != server_guid_prefix_)
@@ -796,7 +798,7 @@ void DiscoveryDataBase::update_participant_from_change_(
796
798
if (ch->write_params .sample_identity ().sequence_number () ==
797
799
participant_info.change ()->write_params .sample_identity ().sequence_number ())
798
800
{
799
- participant_info.add_or_update_ack_participant (ch->writerGUID .guidPrefix , true );
801
+ participant_info.add_or_update_ack_participant (ch->writerGUID .guidPrefix , ParticipantState::ACKED );
800
802
}
801
803
802
804
// we release it if it's the same or if it is lower
@@ -846,7 +848,7 @@ void DiscoveryDataBase::create_writers_from_change_(
846
848
if (ch->write_params .sample_identity ().sequence_number () ==
847
849
writer_it->second .change ()->write_params .sample_identity ().sequence_number ())
848
850
{
849
- writer_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , true );
851
+ writer_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , ParticipantState::ACKED );
850
852
}
851
853
852
854
// we release it if it's the same or if it is lower
@@ -894,7 +896,7 @@ void DiscoveryDataBase::create_writers_from_change_(
894
896
895
897
// Manually set to 1 the relevant participants ACK status of the participant that sent the change. This way,
896
898
// we avoid backprogation of the data.
897
- writer_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , true );
899
+ writer_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , ParticipantState::ACKED );
898
900
899
901
// if topic is virtual, it must iterate over all readers
900
902
if (topic_name == virtual_topic_)
@@ -964,7 +966,7 @@ void DiscoveryDataBase::create_readers_from_change_(
964
966
if (ch->write_params .sample_identity ().sequence_number () ==
965
967
reader_it->second .change ()->write_params .sample_identity ().sequence_number ())
966
968
{
967
- reader_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , true );
969
+ reader_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , ParticipantState::ACKED );
968
970
}
969
971
970
972
// we release it if it's the same or if it is lower
@@ -1012,7 +1014,7 @@ void DiscoveryDataBase::create_readers_from_change_(
1012
1014
1013
1015
// Manually set to 1 the relevant participants ACK status of the participant that sent the change. This way,
1014
1016
// we avoid backprogation of the data.
1015
- reader_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , true );
1017
+ reader_it->second .add_or_update_ack_participant (ch->writerGUID .guidPrefix , ParticipantState::ACKED );
1016
1018
1017
1019
// if topic is virtual, it must iterate over all readers
1018
1020
if (topic_name == virtual_topic_)
@@ -1407,37 +1409,42 @@ bool DiscoveryDataBase::process_dirty_topics()
1407
1409
// Find participants with writer info and participant with reader info in participants_
1408
1410
parts_reader_it = participants_.find (reader.guidPrefix );
1409
1411
parts_writer_it = participants_.find (writer.guidPrefix );
1410
- // Find reader info in readers_
1411
- readers_it = readers_.find (reader);
1412
- // Find writer info in writers_
1413
- writers_it = writers_.find (writer);
1414
1412
1415
1413
// Check in `participants_` whether the client with the reader has acknowledge the PDP of the client
1416
1414
// with the writer.
1417
1415
if (parts_reader_it != participants_.end ())
1418
1416
{
1419
1417
if (parts_reader_it->second .is_matched (writer.guidPrefix ))
1420
1418
{
1419
+ // Find reader info in readers_
1420
+ readers_it = readers_.find (reader);
1421
1421
// Check the status of the writer in `readers_[reader]::relevant_participants_builtin_ack_status`.
1422
1422
if (readers_it != readers_.end () &&
1423
1423
readers_it->second .is_relevant_participant (writer.guidPrefix ) &&
1424
- !readers_it->second .is_matched (writer.guidPrefix ))
1424
+ !readers_it->second .is_waiting_ack (writer.guidPrefix ))
1425
1425
{
1426
1426
// If the status is 0, add DATA(r) to a `edp_publications_to_send_` (if it's not there).
1427
1427
if (add_edp_subscriptions_to_send_ (readers_it->second .change ()))
1428
1428
{
1429
1429
EPROSIMA_LOG_INFO (DISCOVERY_DATABASE, " Addind DATA(r) to send: "
1430
1430
<< readers_it->second .change ()->instanceHandle );
1431
+ readers_it->second .add_or_update_ack_participant (writer.guidPrefix ,
1432
+ ParticipantState::WAITING_ACK);
1431
1433
}
1432
1434
}
1433
1435
}
1434
1436
else if (parts_reader_it->second .is_relevant_participant (writer.guidPrefix ))
1435
1437
{
1436
- // Add DATA(p) of the client with the writer to `pdp_to_send_` (if it's not there).
1437
- if (add_pdp_to_send_ (parts_reader_it->second .change ()))
1438
+ if (!parts_reader_it->second .is_waiting_ack (writer.guidPrefix ))
1438
1439
{
1439
- EPROSIMA_LOG_INFO (DISCOVERY_DATABASE, " Addind readers' DATA(p) to send: "
1440
- << parts_reader_it->second .change ()->instanceHandle );
1440
+ // Add DATA(p) of the client with the writer to `pdp_to_send_` (if it's not there).
1441
+ if (add_pdp_to_send_ (parts_reader_it->second .change ()))
1442
+ {
1443
+ EPROSIMA_LOG_INFO (DISCOVERY_DATABASE, " Adding readers' DATA(p) to send: "
1444
+ << parts_reader_it->second .change ()->instanceHandle );
1445
+ parts_reader_it->second .add_or_update_ack_participant (writer.guidPrefix ,
1446
+ ParticipantState::WAITING_ACK);
1447
+ }
1441
1448
}
1442
1449
// Set topic as not-clearable.
1443
1450
is_clearable = false ;
@@ -1450,26 +1457,35 @@ bool DiscoveryDataBase::process_dirty_topics()
1450
1457
{
1451
1458
if (parts_writer_it->second .is_matched (reader.guidPrefix ))
1452
1459
{
1460
+ // Find writer info in writers_
1461
+ writers_it = writers_.find (writer);
1453
1462
// Check the status of the reader in `writers_[writer]::relevant_participants_builtin_ack_status`.
1454
1463
if (writers_it != writers_.end () &&
1455
1464
writers_it->second .is_relevant_participant (reader.guidPrefix ) &&
1456
- !writers_it->second .is_matched (reader.guidPrefix ))
1465
+ !writers_it->second .is_waiting_ack (reader.guidPrefix ))
1457
1466
{
1458
1467
// If the status is 0, add DATA(w) to a `edp_subscriptions_to_send_` (if it's not there).
1459
1468
if (add_edp_publications_to_send_ (writers_it->second .change ()))
1460
1469
{
1461
1470
EPROSIMA_LOG_INFO (DISCOVERY_DATABASE, " Addind DATA(w) to send: "
1462
1471
<< writers_it->second .change ()->instanceHandle );
1472
+ writers_it->second .add_or_update_ack_participant (reader.guidPrefix ,
1473
+ ParticipantState::WAITING_ACK);
1463
1474
}
1464
1475
}
1465
1476
}
1466
1477
else if (parts_writer_it->second .is_relevant_participant (reader.guidPrefix ))
1467
1478
{
1468
- // Add DATA(p) of the client with the reader to `pdp_to_send_` (if it's not there).
1469
- if (add_pdp_to_send_ (parts_writer_it->second .change ()))
1479
+ if (!parts_writer_it->second .is_waiting_ack (reader.guidPrefix ))
1470
1480
{
1471
- EPROSIMA_LOG_INFO (DISCOVERY_DATABASE, " Addind writers' DATA(p) to send: "
1472
- << parts_writer_it->second .change ()->instanceHandle );
1481
+ // Add DATA(p) of the client with the reader to `pdp_to_send_` (if it's not there).
1482
+ if (add_pdp_to_send_ (parts_writer_it->second .change ()))
1483
+ {
1484
+ EPROSIMA_LOG_INFO (DISCOVERY_DATABASE, " Adding writers' DATA(p) to send: "
1485
+ << parts_writer_it->second .change ()->instanceHandle );
1486
+ parts_writer_it->second .add_or_update_ack_participant (reader.guidPrefix ,
1487
+ ParticipantState::WAITING_ACK);
1488
+ }
1473
1489
}
1474
1490
// Set topic as not-clearable.
1475
1491
is_clearable = false ;
@@ -2463,7 +2479,7 @@ bool DiscoveryDataBase::from_json(
2463
2479
// Populate GuidPrefix_t
2464
2480
std::istringstream (it_ack.key ()) >> prefix_aux_ack;
2465
2481
2466
- dpi.add_or_update_ack_participant (prefix_aux_ack, it_ack.value ().get <bool >());
2482
+ dpi.add_or_update_ack_participant (prefix_aux_ack, it_ack.value ().get <ParticipantState >());
2467
2483
}
2468
2484
2469
2485
// Add Participant
@@ -2501,7 +2517,7 @@ bool DiscoveryDataBase::from_json(
2501
2517
// Populate GuidPrefix_t
2502
2518
std::istringstream (it_ack.key ()) >> prefix_aux_ack;
2503
2519
2504
- dei.add_or_update_ack_participant (prefix_aux_ack, it_ack.value ().get <bool >());
2520
+ dei.add_or_update_ack_participant (prefix_aux_ack, it_ack.value ().get <ParticipantState >());
2505
2521
}
2506
2522
2507
2523
// Add Participant
@@ -2561,7 +2577,7 @@ bool DiscoveryDataBase::from_json(
2561
2577
// Populate GuidPrefix_t
2562
2578
std::istringstream (it_ack.key ()) >> prefix_aux_ack;
2563
2579
2564
- dei.add_or_update_ack_participant (prefix_aux_ack, it_ack.value ().get <bool >());
2580
+ dei.add_or_update_ack_participant (prefix_aux_ack, it_ack.value ().get <ParticipantState >());
2565
2581
}
2566
2582
2567
2583
// Add Participant
0 commit comments