Skip to content

Commit

Permalink
Refs #20936: Revision
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
  • Loading branch information
cferreiragonz committed Jun 12, 2024
1 parent 475ca22 commit d490fad
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/cpp/rtps/builtin/discovery/participant/PDP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ bool PDP::enable()
return true;
}

// Perform pre-enable actions (if any)
pre_enable_actions();

// Create lease events on already created proxy data objects
for (ParticipantProxyData* pool_item : participant_proxies_pool_)
{
Expand Down Expand Up @@ -443,6 +446,11 @@ bool PDP::enable()
return builtin_endpoints_->enable_pdp_readers(mp_RTPSParticipant);
}

void PDP::pre_enable_actions()
{
// Empty implementation
}

void PDP::disable()
{
// Extract all the participant proxies excluding first one (ourselves)
Expand Down
7 changes: 6 additions & 1 deletion src/cpp/rtps/builtin/discovery/participant/PDP.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ class PDP : public fastdds::statistics::rtps::IProxyQueryable
*
* @return true if enabled correctly, or if already enabled; false otherwise
*/
virtual bool enable();
bool enable();

/**
* @brief Perform actions before enabling the Participant Discovery Protocol if needed
*/
virtual void pre_enable_actions();

/**
* @brief Disable the Participant Discovery Protocol
Expand Down
4 changes: 1 addition & 3 deletions src/cpp/rtps/builtin/discovery/participant/PDPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool PDPServer::init(
return true;
}

bool PDPServer::enable()
void PDPServer::pre_enable_actions()
{
std::vector<nlohmann::json> backup_queue;
// Restore the DDB from file if this is a BACKUP server
Expand Down Expand Up @@ -190,8 +190,6 @@ bool PDPServer::enable()
// This vector is empty till backup queue is implemented
process_backup_restore_queue(backup_queue);
}

return PDP::enable();
}

ParticipantProxyData* PDPServer::createParticipantProxyData(
Expand Down
9 changes: 4 additions & 5 deletions src/cpp/rtps/builtin/discovery/participant/PDPServer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,11 @@ class PDPServer : public fastrtps::rtps::PDP
fastrtps::rtps::RTPSParticipantImpl* part) override;

/**
* @brief Enable the Participant Discovery Protocol and checks if a backup file
* needs to be restored for DiscoveryProtocol_t::BACKUP.
*
* @return true if enabled correctly, or if already enabled; false otherwise
* @brief Checks if a backup file needs to be restored for
* DiscoveryProtocol_t::BACKUP before enabling the Participant Discovery Protocol
*/
bool enable() override;
void pre_enable_actions() override;

/**
* Creates an initializes a new participant proxy from a DATA(p) raw info
* @param p ParticipantProxyData from DATA msg deserialization
Expand Down

0 comments on commit d490fad

Please sign in to comment.