* Improved hash checking, it now stops a torrent if some chunk

mappings fail even though a file has been allocated.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@578 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-10-10 19:36:12 +00:00
parent 881f515d03
commit ad80247ba6
4 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -66,7 +66,7 @@ Download::set_download(torrent::Download d) {
m_connTrackerSucceded = m_download.signal_tracker_succeded(sigc::bind(sigc::mem_fun(*this, &Download::receive_tracker_msg), ""));
m_connTrackerFailed = m_download.signal_tracker_failed(sigc::mem_fun(*this, &Download::receive_tracker_msg));
m_connStorageError = m_download.signal_storage_error(sigc::mem_fun(*this, &Download::receive_tracker_msg));
m_connStorageError = m_download.signal_storage_error(sigc::mem_fun(*this, &Download::receive_storage_error));
}
void
+2 -1
View File
@@ -90,7 +90,8 @@ DownloadList::close(Download* d) {
void
DownloadList::start(Download* d) {
if (d->get_download().is_active())
if (d->get_download().is_active() ||
!d->get_download().is_hash_checked())
return;
open(d);
+9 -3
View File
@@ -61,9 +61,14 @@ connect_signal_network_log(Download* d, torrent::Download::SlotString s) {
d->get_download().signal_network_log(s);
}
// static void
// connect_signal_tracker_log(Download* d, torrent::Download::SlotString s) {
// d->get_download().signal_tracker_failed(s);
// }
static void
connect_signal_tracker_log(Download* d, torrent::Download::SlotString s) {
d->get_download().signal_tracker_failed(s);
connect_signal_storage_log(Download* d, torrent::Download::SlotString s) {
d->get_download().signal_storage_error(s);
}
Manager::Manager() :
@@ -99,7 +104,8 @@ Manager::initialize_second() {
// opened or closed.
m_downloadList.slot_map_insert()["0_initialize_bencode"] = sigc::mem_fun(*this, &Manager::initialize_bencode);
m_downloadList.slot_map_insert()["1_connect_network_log"] = sigc::bind(sigc::ptr_fun(&connect_signal_network_log), sigc::mem_fun(m_logComplete, &Log::push_front));
m_downloadList.slot_map_insert()["1_connect_tracker_log"] = sigc::bind(sigc::ptr_fun(&connect_signal_tracker_log), sigc::mem_fun(m_logComplete, &Log::push_front));
// m_downloadList.slot_map_insert()["1_connect_tracker_log"] = sigc::bind(sigc::ptr_fun(&connect_signal_tracker_log), sigc::mem_fun(m_logComplete, &Log::push_front));
m_downloadList.slot_map_insert()["1_connect_storage_log"] = sigc::bind(sigc::ptr_fun(&connect_signal_storage_log), sigc::mem_fun(m_logComplete, &Log::push_front));
//m_downloadList.slot_map_insert()["1_enable_udp_trackers"] = sigc::bind(sigc::mem_fun(&core::Download::enable_udp_trackers), true);
m_downloadList.slot_map_erase()["1_hash_queue_remove"] = sigc::mem_fun(m_hashQueue, &HashQueue::remove);
+3 -3
View File
@@ -80,6 +80,9 @@ print_download_info(char* buf, unsigned int length, core::Download* d) {
char*
print_download_status(char* buf, unsigned int length, core::Download* d) {
if (!d->get_download().is_active())
buf += std::max(0, snprintf(buf, length, "Inactive: "));
if (d->get_download().is_hash_checking())
buf += std::max(0, snprintf(buf, length, "Checking hash"));
@@ -90,9 +93,6 @@ print_download_status(char* buf, unsigned int length, core::Download* d) {
d->get_download().get_tracker_focus(),
d->get_download().get_tracker(d->get_download().get_tracker_focus()).get_url().c_str()));
else if (!d->get_download().is_active())
buf += std::max(0, snprintf(buf, length, "Inactive"));
else if (!d->get_message().empty())
buf += std::max(0, snprintf(buf, length, "%s", d->get_message().c_str()));