* Replaced the old TrackerList API with the cleaned up

TrackerContainer code.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1005 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-11-08 16:33:51 +00:00
parent 4a2ae4d339
commit 04e6575e5d
9 changed files with 33 additions and 42 deletions
+4 -8
View File
@@ -58,8 +58,6 @@ namespace core {
Download::Download(download_type d) :
m_download(d),
m_trackerList(d.tracker_list()),
m_hashFailed(false),
m_chunksFailed(0),
@@ -85,14 +83,12 @@ Download::~Download() {
void
Download::enable_udp_trackers(bool state) {
torrent::TrackerList tl = m_download.tracker_list();
for (int i = 0, last = tl.size(); i < last; ++i)
if (tl.get(i)->type() == torrent::Tracker::TRACKER_UDP)
for (torrent::TrackerList::iterator itr = m_download.tracker_list()->begin(), last = m_download.tracker_list()->end(); itr != last; ++itr)
if ((*itr)->type() == torrent::Tracker::TRACKER_UDP)
if (state)
tl.get(i)->enable();
(*itr)->enable();
else
tl.get(i)->disable();
(*itr)->disable();
}
uint32_t
+2 -2
View File
@@ -88,7 +88,8 @@ public:
const file_list_type* c_file_list() const { return m_download.file_list(); }
torrent::Object* bencode() { return m_download.bencode(); }
tracker_list_type* tracker_list() { return &m_trackerList; }
tracker_list_type* tracker_list() { return m_download.tracker_list(); }
uint32_t tracker_list_size() const { return m_download.tracker_list()->size(); }
const std::string& message() const { return m_message; }
void set_message(const std::string& msg) { m_message = msg; }
@@ -120,7 +121,6 @@ private:
// Store the FileList instance so we can use slots etc on it.
download_type m_download;
tracker_list_type m_trackerList;
bool m_hashFailed;
+2 -2
View File
@@ -269,7 +269,7 @@ DownloadList::close_quick(Download* download) {
// handled by some parameter to the close function, or some other
// way of giving the client more control of when STOPPED requests
// are sent.
download->download()->tracker_list().manual_cancel();
download->download()->tracker_list()->manual_cancel();
}
void
@@ -607,7 +607,7 @@ DownloadList::confirm_finished(Download* download) {
// Send the completed request before resuming so we don't reset the
// up/downloaded baseline.
download->download()->tracker_list().send_completed();
download->download()->tracker_list()->send_completed();
std::for_each(slot_map_finished().begin(), slot_map_finished().end(), download_list_call(download));