Implement another flavor of TransactionTable::find() with mobile ID and service type.
This commit is contained in:
parent
aeedcc50b6
commit
bf4c962d41
|
@ -386,6 +386,34 @@ bool TransactionTable::find(const L3MobileIdentity& mobileID, TransactionEntry&
|
|||
return foundIt;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool TransactionTable::find(const L3MobileIdentity& mobileID, GSM::L3CMServiceType serviceType, TransactionEntry& target)
|
||||
{
|
||||
// Yes, it's linear time.
|
||||
// Even in a 6-ARFCN system, it should rarely be more than a dozen entries.
|
||||
|
||||
// Since clearDeadEntries is also linear, do that here, too.
|
||||
|
||||
// Brute force search.
|
||||
bool foundIt = false;
|
||||
mLock.lock();
|
||||
clearDeadEntries();
|
||||
TransactionMap::const_iterator itr = mTable.begin();
|
||||
while (itr!=mTable.end()) {
|
||||
const TransactionEntry& transaction = itr->second;
|
||||
if (transaction.subscriber()==mobileID && transaction.service()==serviceType) {
|
||||
// No need to check dead(), since we just cleared the table.
|
||||
foundIt = true;
|
||||
target = transaction;
|
||||
break;
|
||||
}
|
||||
++itr;
|
||||
}
|
||||
mLock.unlock();
|
||||
return foundIt;
|
||||
}
|
||||
|
||||
size_t TransactionTable::size()
|
||||
{
|
||||
return mTable.size();
|
||||
|
|
|
@ -679,6 +679,16 @@ class TransactionTable {
|
|||
*/
|
||||
bool find(const GSM::L3MobileIdentity& mobileID, TransactionEntry& target);
|
||||
|
||||
/**
|
||||
Find an entry by its mobile ID and service type.
|
||||
Also clears dead entries during search.
|
||||
@param mobileID The mobile at to search for.
|
||||
@param serviceType Service type we're looking for.
|
||||
@param target A TransactionEntry to accept the found record.
|
||||
@return true is the mobile ID was found.
|
||||
*/
|
||||
bool find(const GSM::L3MobileIdentity& mobileID, GSM::L3CMServiceType serviceType, TransactionEntry& target);
|
||||
|
||||
/**
|
||||
Remove "dead" entries from the table.
|
||||
A "dead" entry is a transaction that is no longer active.
|
||||
|
|
Reference in New Issue