Hello. I am looking for safe code to terminate all active RTSPClient (and their connections) without stopping main Live555 loop.
Right now Live555 loop run in separate thread. The clean up function can be called from the another thread and looks like this: void RTSPSession::cleanup() { HashTable const& objects = MediaLookupTable::ourMedia(*m_pliveenvironment)->getTable(); HashTable::Iterator* piterator = HashTable::Iterator::create(objects); MediaSession* pmediasession; vector<MediaSession*> clients; char const* key; while ( (pmediasession = (MediaSession*)piterator->next(key)) != NULL ) if (pmediasession->isRTSPClient()) clients.push_back(pmediasession); delete piterator; for_each(clients.begin(), clients.end(), bind1st(mem_fun(&RTSPSession::delete_client), this)); } void RTSPSession::delete_client(MediaSession* medium) { ((myRTSPClient*)medium)->shutdown(); } void myRTSPClient::shutdown() { MediaSubsession* psubsession; unsigned int total = 0; if (m_pmediasession) { MediaSubsessionIterator iterator(*m_pmediasession); while((psubsession = iterator.next()) != 0) total += shutdown(psubsession); if (total) sendTeardownCommand(*m_pmediasession, 0); } Medium::close(this); } ... virtual myRTSPClient::~myRTSPClient() { ... if (m_pmediasession) Medium::close(m_pmediasession); ... } But i am not sure - maybe the safest and more easiest way (without direct interaction with underlying hashtable) exist to do forcibly disconnection and cleaning up of all existed clients? ps Again, I don't want to stop Live555 loop so it is possible the data can arrive at any moment so I also need to guard this and prevent any client code if cleanup procedure is started. WBR, Anton
_______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel