void Pager::addID(const FuzzingL3MobileIdentity& newID, ChannelType chanType, TransactionEntry& transaction, unsigned wLife) { transaction.Q931State(TransactionEntry::Paging); transaction.T3113().set(wLife); gTransactionTable.update(transaction); // Add a mobile ID to the paging list for a given lifetime. mLock.lock(); // If this ID is already in the list, just reset its timer. // Uhg, another linear time search. // This would be faster if the paging list were ordered by ID. // But the list should usually be short, so it may not be worth the effort. for (PagingEntryList::iterator lp = mPageIDs.begin(); lp != mPageIDs.end(); ++lp) { if (lp->FuzzingID()==newID) { LOG(DEBUG) << newID << " already in table"; lp->renew(wLife); mPageSignal.signal(); mLock.unlock(); return; } } // If this ID is new, put it in the list. mPageIDs.push_back(PagingEntry(newID,chanType,transaction.ID(),wLife)); LOG(INFO) << newID << " added to table"; mPageSignal.signal(); mLock.unlock(); }
unsigned Pager::removeID(const FuzzingL3MobileIdentity& delID) { // Return the associated transaction ID, or 0 if none found. unsigned retVal = 0; LOG(INFO) << delID; mLock.lock(); for (PagingEntryList::iterator lp = mPageIDs.begin(); lp != mPageIDs.end(); ++lp) { if (lp->FuzzingID()==delID) { retVal = lp->transactionID(); mPageIDs.erase(lp); break; } } mLock.unlock(); return retVal; }