See if there are any new transactions to start. If all transactions are gone, initiate a channel release. Return true if anything happened.
| 141 | // If all transactions are gone, initiate a channel release. |
| 142 | // Return true if anything happened. |
| 143 | bool MMContext::mmCheckNewActivity() |
| 144 | { |
| 145 | // If there is a mobility management procedure in progress then we wont start anything else until it is finished. |
| 146 | // We shouldnt need to lock gMMLock yet because the MMContext cannot be deleted while in the thread that called us, |
| 147 | // and mmcServiceRequests is a thread safe queue. |
| 148 | if (! mmInMobilityManagement()) { |
| 149 | if (const L3Message *l3msg = mmcServiceRequests.readNoBlock()) { |
| 150 | const L3CMServiceRequest *cmmsg = dynamic_cast<typeof(cmmsg)>(l3msg); |
| 151 | NewCMServiceResponder(cmmsg,this); |
| 152 | delete cmmsg; |
| 153 | return true; |
| 154 | } |
| 155 | // We are refererencing the MMUser so we cannot let that change and the only |
| 156 | // completely safe way to do that is to lock the entire MMLayer. |
| 157 | // The unlock() corresponding to this lock() may be in mmuServiceMTQueues. |
| 158 | gMMLock.lock(__FILE__,__LINE__); |
| 159 | if (mmcMMU) { |
| 160 | if (mmcMMU->mmuServiceMTQueues()) { return true; } |
| 161 | } |
| 162 | gMMLock.unlock(); |
| 163 | } |
| 164 | // If there are no transactions, kill the channel. |
| 165 | // TODO: A new SIP transaction could creep in here between the time |
| 166 | // we check isEmpty and when the channel actually closes. |
| 167 | // What to do about that? |
| 168 | // When we detach the MMUser, if it has anything on it, just leave it there, |
| 169 | // and paging will restart. |
| 170 | if (mmIsEmpty()) { |
| 171 | mmcChan->chanClose(L3RRCause::NormalEvent,RELEASE); |
| 172 | return true; // This is new activity - the calling loop should skip back to the top |
| 173 | } |
| 174 | return false; |
| 175 | } |
| 176 | |
| 177 | // What a stupid language. |
| 178 | MMUser::MMUser(string& wImsi) |
no test coverage detected