diff --git a/configs/fne-config.example.yml b/configs/fne-config.example.yml index e4faabde..3b97572e 100644 --- a/configs/fne-config.example.yml +++ b/configs/fne-config.example.yml @@ -251,6 +251,11 @@ master: # Amount of time in seconds for a call collision to last before switching over the source of a call. callCollisionTimeout: 5 + # Time in minutes to retain subscriber operation records. + subscriberOpRetention: 5 + # Time in minutes to retain subscriber operation status records. + subscriberOpStatusRetention: 10 + # Flag indicating whether or not a grant responses will only be sent to TGs with affiliations, if the TG is configured for affiliation gating. restrictGrantToAffiliatedOnly: false # Flag indicating whether or not a adjacent site broadcasts will pass to any peers. diff --git a/src/fne/network/SubscriberOperationStore.cpp b/src/fne/network/SubscriberOperationStore.cpp index c10fffd1..12af82e5 100644 --- a/src/fne/network/SubscriberOperationStore.cpp +++ b/src/fne/network/SubscriberOperationStore.cpp @@ -18,8 +18,6 @@ using namespace network; // --------------------------------------------------------------------------- const std::chrono::seconds OPERATION_TIMEOUT(8U); -const std::chrono::minutes RESULT_RETENTION(5U); -const std::chrono::minutes STATUS_RETENTION(15U); // --------------------------------------------------------------------------- // Public Class Members @@ -27,13 +25,14 @@ const std::chrono::minutes STATUS_RETENTION(15U); /* Initializes an empty operation store. */ -SubscriberOperationStore::SubscriberOperationStore() : +SubscriberOperationStore::SubscriberOperationStore(uint32_t operationRetention, uint32_t statusRetention) : m_nextId(1U), m_operations(), m_p25Statuses(), m_mutex() { - /* stub */ + RESULT_RETENTION = std::chrono::minutes(operationRetention); + STATUS_RETENTION = std::chrono::minutes(statusRetention); } /* Starts a uniquely correlatable operation. */ diff --git a/src/fne/network/SubscriberOperationStore.h b/src/fne/network/SubscriberOperationStore.h index cd2e265b..38057460 100644 --- a/src/fne/network/SubscriberOperationStore.h +++ b/src/fne/network/SubscriberOperationStore.h @@ -116,7 +116,18 @@ namespace network /** * @brief Initializes an empty operation store. */ - SubscriberOperationStore(); + SubscriberOperationStore(uint32_t operationRetention, uint32_t statusRetention); + + /** + * @brief Updates operation and status retention periods. + * @param[in] operationRetention Operation retention in minutes. + * @param[in] statusRetention Status retention in minutes. + */ + void setRetention(uint32_t operationRetention, uint32_t statusRetention) + { + RESULT_RETENTION = std::chrono::minutes(operationRetention); + STATUS_RETENTION = std::chrono::minutes(statusRetention); + } /** * @brief Starts a uniquely correlatable operation. @@ -209,6 +220,9 @@ namespace network static const char* stateName(State state); private: + std::chrono::minutes RESULT_RETENTION; + std::chrono::minutes STATUS_RETENTION; + /** * @brief Internal operation record with monotonic expiry deadlines. * @ingroup fne_network diff --git a/src/fne/network/TrafficNetwork.cpp b/src/fne/network/TrafficNetwork.cpp index e8564ac2..e1296180 100644 --- a/src/fne/network/TrafficNetwork.cpp +++ b/src/fne/network/TrafficNetwork.cpp @@ -111,7 +111,7 @@ TrafficNetwork::TrafficNetwork(HostFNE* host, const std::string& address, uint16 m_peerAffiliationsMutex(), m_affiliationUpdateMutex(), m_unitRouteRegistry(), - m_subscriberOperations(), + m_subscriberOperations(5, 10), m_ccPeerMap(), m_peerReplicaKeyQueue(), m_peerReplicaKEKKeyQueue(), @@ -416,6 +416,10 @@ void TrafficNetwork::setOptions(yaml::Node& conf, bool printOptions) m_callCollisionTimeout = conf["callCollisionTimeout"].as(5U); + uint32_t subscriberOpRetention = conf["subscriberOpRetention"].as(5U); + uint32_t subscriberOpStatusRetention = conf["subscriberOpStatusRetention"].as(10U); + m_subscriberOperations.setRetention(subscriberOpRetention, subscriberOpStatusRetention); + m_restrictGrantToAffOnly = conf["restrictGrantToAffiliatedOnly"].as(false); yaml::Node& privateCallRouting = conf["privateCallRouting"]; m_privateCallRoutingEnabled = privateCallRouting["enable"].as(false); @@ -499,6 +503,8 @@ void TrafficNetwork::setOptions(yaml::Node& conf, bool printOptions) if (m_callCollisionTimeout == 0U) { LogWarning(LOG_MASTER, "Call Collisions are disabled because the call collision timeout is set to 0 seconds. This is not recommended, and can cause undesired behavior."); } + LogInfo(" Subscriber Operation Retention: %u minutes", subscriberOpRetention); + LogInfo(" Subscriber Operation Status Retention: %u minutes", subscriberOpStatusRetention); LogInfo(" Restrict grant response by affiliation: %s", m_restrictGrantToAffOnly ? "yes" : "no"); LogInfo(" Disable adjacent site broadcasts to any peers: %s", m_disallowAdjStsBcast ? "yes" : "no"); if (m_disallowAdjStsBcast) {