@@ -119,35 +119,6 @@ bool PDPServer::init(
119119 return false ;
120120 }
121121
122- std::vector<nlohmann::json> backup_queue;
123- if (durability_ == TRANSIENT )
124- {
125- nlohmann::json backup_json;
126- // If the DS is BACKUP, try to restore DDB from file
127- discovery_db ().backup_in_progress (true );
128- if (read_backup (backup_json, backup_queue))
129- {
130- if (process_backup_discovery_database_restore (backup_json))
131- {
132- EPROSIMA_LOG_INFO (RTPS_PDP_SERVER , " DiscoveryDataBase restored correctly" );
133- }
134- }
135- else
136- {
137- EPROSIMA_LOG_INFO (RTPS_PDP_SERVER ,
138- " Error reading backup file. Corrupted or unmissing file, restarting from scratch" );
139- }
140-
141- discovery_db ().backup_in_progress (false );
142-
143- discovery_db_.persistence_enable (get_ddb_queue_persistence_file_name ());
144- }
145- else
146- {
147- // Allows the ddb to process new messages from this point
148- discovery_db_.enable ();
149- }
150-
151122 // Activate listeners
152123 EDPServer* edp = static_cast <EDPServer*>(mp_EDP);
153124 builtin_endpoints_->enable_pdp_readers (getRTPSParticipant ());
@@ -177,14 +148,49 @@ bool PDPServer::init(
177148 m_discovery.discovery_config .discoveryServer_client_syncperiod ));
178149 ping_->restart_timer ();
179150
151+ return true ;
152+ }
153+
154+ bool PDPServer::enable ()
155+ {
156+ std::vector<nlohmann::json> backup_queue;
157+ // Restore the DDB from file if this is a BACKUP server
158+ if (durability_ == TRANSIENT )
159+ {
160+ nlohmann::json backup_json;
161+ // If the DS is BACKUP, try to restore DDB from file
162+ discovery_db ().backup_in_progress (true );
163+ if (read_backup (backup_json, backup_queue))
164+ {
165+ if (process_backup_discovery_database_restore (backup_json))
166+ {
167+ EPROSIMA_LOG_INFO (RTPS_PDP_SERVER , " DiscoveryDataBase restored correctly" );
168+ }
169+ }
170+ else
171+ {
172+ EPROSIMA_LOG_INFO (RTPS_PDP_SERVER ,
173+ " Error reading backup file. Corrupted or unmissing file, restarting from scratch" );
174+ }
175+
176+ discovery_db ().backup_in_progress (false );
177+
178+ discovery_db_.persistence_enable (get_ddb_queue_persistence_file_name ());
179+ }
180+ else
181+ {
182+ // Allows the ddb to process new messages from this point
183+ discovery_db_.enable ();
184+ }
185+
180186 // Restoring the queue must be done after starting the routine
181187 if (durability_ == TRANSIENT )
182188 {
183189 // This vector is empty till backup queue is implemented
184190 process_backup_restore_queue (backup_queue);
185191 }
186192
187- return true ;
193+ return PDP::enable () ;
188194}
189195
190196ParticipantProxyData* PDPServer::createParticipantProxyData (
0 commit comments