add some exception checking around some cases where vector types are used;

pull/86/head
Bryan Biedenkapp 1 year ago
parent 4617a817a1
commit cb335cffed

@ -305,7 +305,9 @@ bool AffiliationLookup::grantCh(uint32_t dstId, uint32_t srcId, uint32_t grantTi
std::lock_guard<std::mutex> lock(m_mutex);
uint32_t chNo = m_chLookup->getFirstRFChannel();
m_chLookup->removeRFCh(chNo);
if (!m_chLookup->removeRFCh(chNo)) {
return false;
}
m_grantChTable[dstId] = chNo;
m_grantSrcIdTable[dstId] = srcId;

@ -71,12 +71,18 @@ bool ChannelLookup::addRFCh(uint32_t chNo, bool force)
/* Helper to remove a RF channel. */
void ChannelLookup::removeRFCh(uint32_t chNo)
bool ChannelLookup::removeRFCh(uint32_t chNo)
{
if (chNo == 0U) {
return;
return false;
}
try {
auto it = std::find(m_rfChTable.begin(), m_rfChTable.end(), chNo);
m_rfChTable.erase(it);
} catch (...) {
return false;
}
return true;
}

@ -206,8 +206,9 @@ namespace lookups
/**
* @brief Helper to remove a RF channel.
* @param chNo Channel Number.
* @returns bool True, if channel remove, otherwise false.
*/
void removeRFCh(uint32_t chNo);
bool removeRFCh(uint32_t chNo);
/**
* @brief Helper to determine if there are any RF channels available..
* @returns bool True, if any RF channels are available for use, otherwise false.

@ -467,6 +467,7 @@ bool Socket::write(BufferVector& buffers, ssize_t* lenWritten) noexcept
continue;
}
try {
// are we crypto wrapped?
if (m_isCryptoWrapped && m_presharedKey != nullptr) {
uint32_t cryptedLen = length * sizeof(uint8_t);
@ -526,6 +527,10 @@ bool Socket::write(BufferVector& buffers, ssize_t* lenWritten) noexcept
headers[i].msg_hdr.msg_control = 0;
headers[i].msg_hdr.msg_controllen = 0;
}
catch (...) {
--size;
}
}
bool skip = false;
for (auto& buffer : buffers) {

Loading…
Cancel
Save

Powered by TurnKey Linux.