catch and log certain situations where a buffer in a buffer vector may be released (this is likely due to a non-tread safe network flush); expose size of inclusion, exclusion and rewrite lists so we don't need to copy them to know the size;

pull/51/head
Bryan Biedenkapp 2 years ago
parent ba785f3d91
commit c3f9b69454

@ -195,6 +195,13 @@ namespace lookups
return *this;
}
/// <summary>Gets the count of inclusions.</summary>
uint8_t inclusionSize() const { return m_inclusion.size(); }
/// <summary>Gets the count of exclusions.</summary>
uint8_t exclusionSize() const { return m_exclusion.size(); }
/// <summary>Gets the count of rewrites.</summary>
uint8_t rewriteSize() const { return m_rewrite.size(); }
/// <summary>Return the YAML structure for this TalkgroupRuleConfig.</summary>
void getYaml(yaml::Node &node)
{

@ -511,7 +511,14 @@ bool Socket::write(BufferVector& buffers, ssize_t* lenWritten) noexcept
bool skip = false;
for (auto& buffer : buffers) {
if (buffer == nullptr) {
LogError(LOG_NET, "Socket::write() missing network buffer data? this isn't normal, aborting");
skip = true;
break;
}
if (m_af != buffer->address.ss_family) {
LogError(LOG_NET, "Socket::write() mismatched network address family? this isn't normal, aborting");
skip = true;
break;
}

@ -422,10 +422,9 @@ bool TagDMRData::peerRewrite(uint32_t peerId, uint32_t& dstId, uint32_t& slotNo,
tg = m_network->m_tidLookup->findByRewrite(peerId, dstId);
}
std::vector<lookups::TalkgroupRuleRewrite> rewrites = tg.config().rewrite();
bool rewrote = false;
if (rewrites.size() > 0) {
if (tg.config().rewriteSize() > 0) {
std::vector<lookups::TalkgroupRuleRewrite> rewrites = tg.config().rewrite();
for (auto entry : rewrites) {
if (entry.peerId() == peerId) {
if (outbound) {

@ -347,10 +347,9 @@ bool TagNXDNData::peerRewrite(uint32_t peerId, uint32_t& dstId, bool outbound)
tg = m_network->m_tidLookup->findByRewrite(peerId, dstId);
}
std::vector<lookups::TalkgroupRuleRewrite> rewrites = tg.config().rewrite();
bool rewrote = false;
if (rewrites.size() > 0) {
if (tg.config().rewriteSize() > 0) {
std::vector<lookups::TalkgroupRuleRewrite> rewrites = tg.config().rewrite();
for (auto entry : rewrites) {
if (entry.peerId() == peerId) {
if (outbound) {

@ -485,9 +485,8 @@ bool TagP25Data::peerRewrite(uint32_t peerId, uint32_t& dstId, bool outbound)
tg = m_network->m_tidLookup->findByRewrite(peerId, dstId);
}
std::vector<lookups::TalkgroupRuleRewrite> rewrites = tg.config().rewrite();
if (rewrites.size() > 0) {
if (tg.config().rewriteSize() > 0) {
std::vector<lookups::TalkgroupRuleRewrite> rewrites = tg.config().rewrite();
for (auto entry : rewrites) {
if (entry.peerId() == peerId) {
if (outbound) {

Loading…
Cancel
Save

Powered by TurnKey Linux.