Skip to content

Commit 9fd9624

Browse files
committed
Use a catalogBuilt flag to prevent runtime insertion until ready
1 parent fb7599f commit 9fd9624

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Svc/DpCatalog/DpCatalog.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ DpCatalog ::DpCatalog(const char* const compName)
3535
m_memPtr(nullptr),
3636
m_allocatorId(0),
3737
m_allocator(nullptr),
38+
m_catalogBuilt(false),
3839
m_xmitInProgress(false),
3940
m_xmitCmdWait(false),
4041
m_xmitBytes(0),
@@ -129,6 +130,8 @@ void DpCatalog::resetBinaryTree() {
129130
// reset number of records
130131
this->m_pendingFiles = 0;
131132
this->m_pendingDpBytes = 0;
133+
// Mark the catalog as un-built
134+
this->m_catalogBuilt = false;
132135
}
133136

134137
void DpCatalog::resetStateFileData() {
@@ -367,6 +370,9 @@ Fw::CmdResponse DpCatalog::doCatalogBuild() {
367370

368371
this->log_ACTIVITY_HI_CatalogBuildComplete();
369372

373+
// Flag so addToCat knows it is good to go
374+
this->m_catalogBuilt = true;
375+
370376
return Fw::CmdResponse::OK;
371377
}
372378

@@ -1006,8 +1012,8 @@ void DpCatalog ::addToCat_handler(FwIndexType portNum,
10061012
return;
10071013
}
10081014

1009-
// Check for state file init
1010-
if (0 == this->m_stateFileEntries) {
1015+
// Check the catalog has been built
1016+
if (not this->m_catalogBuilt) {
10111017
this->log_WARNING_LO_NotLoaded(fileName);
10121018
return;
10131019
}

Svc/DpCatalog/DpCatalog.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ class DpCatalog final : public DpCatalogComponentBase {
261261
FwEnumStoreType m_allocatorId; //!< stored for shutdown
262262
Fw::MemAllocator* m_allocator; //!< stored for shutdown
263263

264+
bool m_catalogBuilt; //!< catalog build is complete (can add DPs at runtime)
264265
bool m_xmitInProgress; //!< set if DP files are in the process of being sent
265266
Fw::FileNameString m_currXmitFileName; //!< current file being transmitted
266267
bool m_xmitCmdWait; //!< true if waiting for transmission complete to complete xmit command

0 commit comments

Comments
 (0)