client_test fix

This commit is contained in:
Arvid Norberg 2007-09-27 16:14:24 +00:00
parent c0195ae221
commit 09c1e0f007
1 changed files with 8 additions and 6 deletions

View File

@ -488,16 +488,18 @@ void scan_dir(path const& dir_path
// remove the torrents that are no longer in the directory // remove the torrents that are no longer in the directory
for (handles_t::iterator i = handles.begin() for (handles_t::iterator i = handles.begin(); !handles.empty() && i != handles.end();)
, end(handles.end()); i != end; ++i)
{ {
if (i->first.empty()) continue; if (i->first.empty() || valid.find(i->first) != valid.end())
if (valid.find(i->first) != valid.end()) continue; {
++i;
continue;
}
torrent_handle& h = i->second; torrent_handle& h = i->second;
if (!h.is_valid()) if (!h.is_valid())
{ {
handles.erase(i--); handles.erase(i);
continue; continue;
} }
@ -512,7 +514,7 @@ void scan_dir(path const& dir_path
bencode(std::ostream_iterator<char>(out), data); bencode(std::ostream_iterator<char>(out), data);
} }
ses.remove_torrent(h); ses.remove_torrent(h);
handles.erase(i--); handles.erase(i);
} }
} }