silence excess log noise;

pull/134/head
Bryan Biedenkapp 3 days ago
parent 4c18326c44
commit b6b9724cb4

@ -65,7 +65,7 @@ AffiliationLookup::~AffiliationLookup() = default;
/* Helper to group affiliate a source ID. */
void AffiliationLookup::unitReg(uint32_t srcId)
void AffiliationLookup::unitReg(uint32_t srcId, bool log)
{
if (isUnitReg(srcId)) {
return;
@ -78,9 +78,8 @@ void AffiliationLookup::unitReg(uint32_t srcId)
m_unitRegTimers[srcId] = Timer(1000U, UNIT_REG_TIMEOUT);
m_unitRegTimers[srcId].start();
if (m_verbose) {
LogInfoEx(LOG_HOST, "%s, unit registration, srcId = %u",
m_name.c_str(), srcId);
if (m_verbose && log) {
LogInfoEx(LOG_HOST, "%s, unit registration, srcId = %u", m_name.c_str(), srcId);
}
__unlock();
@ -88,7 +87,7 @@ void AffiliationLookup::unitReg(uint32_t srcId)
/* Helper to group unaffiliate a source ID. */
bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic)
bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic, bool log)
{
bool ret = false;
@ -100,9 +99,8 @@ bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic)
__lock();
if (m_verbose) {
LogInfoEx(LOG_HOST, "%s, unit deregistration, srcId = %u",
m_name.c_str(), srcId);
if (m_verbose && log) {
LogInfoEx(LOG_HOST, "%s, unit deregistration, srcId = %u", m_name.c_str(), srcId);
}
m_unitRegTimers[srcId].stop();
@ -254,8 +252,7 @@ void AffiliationLookup::groupAff(uint32_t srcId, uint32_t dstId)
m_grpAffTimers[srcId].start();
if (m_verbose) {
LogInfoEx(LOG_HOST, "%s, group affiliation, srcId = %u, dstId = %u",
m_name.c_str(), srcId, dstId);
LogInfoEx(LOG_HOST, "%s, group affiliation, srcId = %u, dstId = %u", m_name.c_str(), srcId, dstId);
}
__unlock();
@ -272,8 +269,7 @@ bool AffiliationLookup::groupUnaff(uint32_t srcId)
auto it = m_grpAffTable.find(srcId);
if (it != m_grpAffTable.end()) {
if (m_verbose) {
LogInfoEx(LOG_HOST, "%s, group unaffiliation, srcId = %u, dstId = %u",
m_name.c_str(), srcId, it->second);
LogInfoEx(LOG_HOST, "%s, group unaffiliation, srcId = %u, dstId = %u", m_name.c_str(), srcId, it->second);
}
m_grpAffTable.erase(srcId);

@ -71,15 +71,17 @@ namespace lookups
/**
* @brief Helper to register a source ID.
* @param srcId Source Radio ID.
* @param log Flag indicating whether the registration should be logged.
*/
virtual void unitReg(uint32_t srcId);
virtual void unitReg(uint32_t srcId, bool log = true);
/**
* @brief Helper to deregister a source ID.
* @param srcId Source Radio ID.
* @param automatic Flag indicating the deregistration is a result of an automated timer.
* @param log Flag indicating whether the deregistration should be logged.
* @returns bool True, if source ID is deregistered, otherwise false.
*/
virtual bool unitDereg(uint32_t srcId, bool automatic = false);
virtual bool unitDereg(uint32_t srcId, bool automatic = false, bool log = true);
/**
* @brief Helper to start the source ID registration timer.
* @param srcId Source Radio ID.

@ -31,21 +31,21 @@ AffiliationLookup::~AffiliationLookup() = default;
/* Helper to group affiliate a source ID. */
void AffiliationLookup::unitReg(uint32_t srcId, uint32_t ssrc)
void AffiliationLookup::unitReg(uint32_t srcId, uint32_t ssrc, bool log)
{
if (isUnitReg(srcId)) {
m_unitRegPeerTable[srcId] = ssrc;
return;
}
::lookups::AffiliationLookup::unitReg(srcId);
::lookups::AffiliationLookup::unitReg(srcId, log);
m_unitRegPeerTable[srcId] = ssrc;
}
/* Helper to group unaffiliate a source ID. */
bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic)
bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic, bool log)
{
bool ret = false;
@ -53,7 +53,7 @@ bool AffiliationLookup::unitDereg(uint32_t srcId, bool automatic)
return false;
}
ret = ::lookups::AffiliationLookup::unitDereg(srcId, automatic);
ret = ::lookups::AffiliationLookup::unitDereg(srcId, automatic, log);
if (ret) {
// lookup dynamic table entry

@ -60,15 +60,17 @@ namespace fne_lookups
* @brief Helper to register a source ID.
* @param srcId Source Radio ID.
* @param ssrc Originating Peer ID.
* @param log Flag indicating whether the registration should be logged.
*/
void unitReg(uint32_t srcId, uint32_t ssrc);
void unitReg(uint32_t srcId, uint32_t ssrc, bool log = true);
/**
* @brief Helper to deregister a source ID.
* @param srcId Source Radio ID.
* @param automatic Flag indicating the deregistration is a result of an automated timer.
* @param log Flag indicating whether the deregistration should be logged.
* @returns bool True, if source ID is deregistered, otherwise false.
*/
bool unitDereg(uint32_t srcId, bool automatic = false) override;
bool unitDereg(uint32_t srcId, bool automatic = false, bool log = true) override;
/**
* @brief Helper to get the originating network peer ID by the registered source ID.
* @param srcId Source Radio ID.

@ -981,7 +981,7 @@ void TrafficNetwork::clock(uint32_t ms)
const std::vector<UnitRoute> expiredRoutes = m_unitRouteRegistry.expire(now);
for (const UnitRoute& route : expiredRoutes) {
LogInfoEx(LOG_MASTER, "Private call route expired, srcId = %u, peerId = %u", route.unitId, route.peerId);
removePeerUnitRegistration(route.peerId, route.unitId);
removePeerUnitRegistration(route.peerId, route.unitId, false);
}
MetricsLogging::resetActiveCalls();
@ -1640,7 +1640,7 @@ void TrafficNetwork::learnUnitRouteFromTraffic(uint32_t peerId, uint32_t srcId,
// update the peer unit registration
const UnitRoute current = m_unitRouteRegistry.resolve(srcId, now);
if (!current.valid || current.peerId != peerId) {
updatePeerUnitRegistration(peerId, srcId, ssrc);
updatePeerUnitRegistration(peerId, srcId, ssrc, false);
}
m_unitRouteRegistry.update(srcId, peerId, ssrc, true, now);
@ -1833,6 +1833,7 @@ bool TrafficNetwork::updatePeerAffiliation(uint32_t peerId, uint32_t srcId, uint
affiliations->groupUnaff(srcId);
affiliations->groupAff(srcId, dstId);
aggregate = buildAggregatedAffiliations();
}
@ -1854,6 +1855,7 @@ bool TrafficNetwork::removePeerAffiliation(uint32_t peerId, uint32_t srcId)
return false;
affiliations->groupUnaff(srcId);
aggregate = buildAggregatedAffiliations();
}
@ -1875,6 +1877,7 @@ bool TrafficNetwork::replacePeerAffiliations(uint32_t peerId, const std::unorder
return false;
peerAffiliations->replaceGroupAffiliations(affiliations);
aggregate = buildAggregatedAffiliations();
}
@ -1901,12 +1904,12 @@ std::unordered_map<uint32_t, uint32_t> TrafficNetwork::buildAggregatedAffiliatio
const std::unordered_map<uint32_t, uint32_t> affiliations = peer.second->grpAffTable();
for (const auto& affiliation : affiliations) {
const auto result = aggregate.emplace(affiliation.first, affiliation.second);
/*
/*
if (!result.second && result.first->second != affiliation.second) {
LogWarning(LOG_MASTER, "PEER %u affiliation conflict, srcId = %u, dstId = %u already represented by dstId = %u from a lower peer ID",
peer.first, affiliation.first, affiliation.second, result.first->second);
}
*/
*/
}
}
@ -1926,7 +1929,7 @@ void TrafficNetwork::publishAggregatedAffiliations(const std::unordered_map<uint
/* Adds one peer unit registration and publishes the aggregate upstream. */
bool TrafficNetwork::updatePeerUnitRegistration(uint32_t peerId, uint32_t srcId, uint32_t ssrc)
bool TrafficNetwork::updatePeerUnitRegistration(uint32_t peerId, uint32_t srcId, uint32_t ssrc, bool log)
{
std::vector<uint32_t> aggregate;
@ -1942,10 +1945,11 @@ bool TrafficNetwork::updatePeerUnitRegistration(uint32_t peerId, uint32_t srcId,
if (registrations == nullptr)
return false;
registrations->unitReg(srcId, ssrc);
const uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::system_clock::now().time_since_epoch()).count();
registrations->unitReg(srcId, ssrc, log);
const uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
m_unitRouteRegistry.update(srcId, peerId, ssrc, false, now);
aggregate = buildAggregatedUnitRegistrations();
}
@ -1955,7 +1959,7 @@ bool TrafficNetwork::updatePeerUnitRegistration(uint32_t peerId, uint32_t srcId,
/* Removes one peer unit registration and publishes the aggregate upstream. */
bool TrafficNetwork::removePeerUnitRegistration(uint32_t peerId, uint32_t srcId)
bool TrafficNetwork::removePeerUnitRegistration(uint32_t peerId, uint32_t srcId, bool log)
{
std::vector<uint32_t> aggregate;
std::unordered_map<uint32_t, uint32_t> aggregateAffiliations;
@ -1967,8 +1971,10 @@ bool TrafficNetwork::removePeerUnitRegistration(uint32_t peerId, uint32_t srcId)
if (registrations == nullptr)
return false;
registrations->unitDereg(srcId);
registrations->unitDereg(srcId, false, log);
m_unitRouteRegistry.erase(srcId, peerId);
aggregate = buildAggregatedUnitRegistrations();
aggregateAffiliations = buildAggregatedAffiliations();
}
@ -1998,8 +2004,10 @@ bool TrafficNetwork::replacePeerUnitRegistrations(uint32_t peerId, const std::ve
registrationOrigins[srcId] = ssrc;
peerRegistrations->replaceUnitRegistrations(registrationOrigins);
const uint64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
m_unitRouteRegistry.replacePeer(peerId, registrations, ssrc, now);
aggregate = buildAggregatedUnitRegistrations();
}
@ -2026,21 +2034,24 @@ std::vector<uint32_t> TrafficNetwork::buildAggregatedUnitRegistrations()
for (const uint32_t srcId : registrations) {
const uint32_t ssrc = peer.second->getSSRCByUnitReg(srcId);
const auto result = aggregateOrigins.emplace(srcId, ssrc);
/*
/*
if (!result.second && result.first->second != ssrc) {
LogWarning(LOG_MASTER, "PEER %u unit registration conflict, srcId = %u already represented by lower peer ID", peer.first, srcId);
}
*/
*/
}
}
m_globalAff->replaceUnitRegistrations(aggregateOrigins);
// build the aggregate list of unit registrations from the origins map
std::vector<uint32_t> aggregate;
aggregate.reserve(aggregateOrigins.size());
for (const auto& registration : aggregateOrigins)
aggregate.push_back(registration.first);
std::sort(aggregate.begin(), aggregate.end());
return aggregate;
}

@ -863,16 +863,18 @@ namespace network
* @param peerId Peer ID.
* @param srcId Source Radio ID.
* @param ssrc Originating peer ID.
* @param log Flag indicating whether the registration should be logged.
* @returns bool True, if the peer affiliation lookup exists, otherwise false.
*/
bool updatePeerUnitRegistration(uint32_t peerId, uint32_t srcId, uint32_t ssrc);
bool updatePeerUnitRegistration(uint32_t peerId, uint32_t srcId, uint32_t ssrc, bool log = true);
/**
* @brief Removes one peer unit registration and publishes the aggregate upstream.
* @param peerId Peer ID.
* @param srcId Source Radio ID.
* @param log Flag indicating whether the deregistration should be logged.
* @returns bool True, if the peer affiliation lookup exists, otherwise false.
*/
bool removePeerUnitRegistration(uint32_t peerId, uint32_t srcId);
bool removePeerUnitRegistration(uint32_t peerId, uint32_t srcId, bool log = true);
/**
* @brief Replaces one peer's unit registrations and publishes the aggregate upstream.
* @param peerId Peer ID.

Loading…
Cancel
Save

Powered by TurnKey Linux.