void AmSessionContainer::destroySession(AmSession* s) { AmEventQueueInterface* q = AmEventDispatcher::instance()-> delEventQueue(s->getLocalTag()); if(q) { stopAndQueue(s); } else { WARN("could not remove session: id not found or wrong type\n"); } }
void AmSessionContainer::destroySession(const string& local_tag) { as_mut.lock(); SessionMapIter sess_it = a_sessions.find(local_tag); if(sess_it != a_sessions.end()){ AmSession* sess = sess_it->second; as_id_lookup.erase(sess->getCallID() + sess->getRemoteTag()); a_sessions.erase(sess_it); stopAndQueue(sess); DBG("session stopped and queued for deletion (#sessions=%u)\n", (unsigned int)a_sessions.size()); } else { DBG("could not remove session: id not found\n"); } as_mut.unlock(); }
void Spawner::enable( bool mustEnable ) { if (_enable != mustEnable) { printf( "[util::Spawner] Enable: old=%d, new=%d\n", _enable, mustEnable ); _enable = mustEnable; if (_enable) { // Spawn pending process for (int i=0; i<static_cast<int>(_tasks.size()); i++) { if (!runQueued()) { break; } } } else { // Stop all process and enqueue BOOST_FOREACH( TaskItem *item, _tasks ) { if (item->pid() >= 0) { stopAndQueue(item); } } } }