void CSearchManager::jumpStart(void) { time_t now = time(NULL); try { SearchMap::iterator it = m_searches.begin(); while (it != m_searches.end()) { switch(it->second->getSearchTypes()){ case CSearch::FILE: {
eMule 0.47a (bad)
void CSearchManager::JumpStart() { // Find any searches that has stalled and jumpstart them. // This will also prune all searches. time_t tNow = time(NULL); for (SearchMap::iterator itSearchMap = m_mapSearches.begin(); itSearchMap != m_mapSearches.end(); [B]++itSearchMap[/B]) { // Each type has it's own criteria for being deleted or jumpstarted. switch(itSearchMap->second->GetSearchTypes()) {
It's obvious that the author of 0.47a does not understand the nuances of C++ STL. You will see some iterators get incremented twice. Deleting any items in any container invalidates the iterator. Microsoft implements something non-standard which allows you to get an iterator to the next item after the deleted iterator. Rather than expounding on Microsoft's way, this is a programming bug that's causing Kademlia to crash eMule.
This post has been edited by ani: 09 April 2006 - 03:19 PM