* Removed core::HashQueue, using the "hashing" view and a function in

core::Manager instead.

* Added a new :rtorrent:hashing state so we can distinguish between
initial hashing and manual rehashes. The former is cleared if the
download is paused.

* Added a hash failed flag to core::Download. This is used to skip
entries in the hashing view that either failed to open or are in the
process of being erased from DownloadList.

* torrent::Bitfield::unset was incrementing, rather than decrementing,
the m_set counter.

* Replaced all torrent::internal_error's in rtorrent with
torrent::client_error.

* ^D now checks :rtorrent:state to decide whetever to stop or erase a
download. Downloads queued for hashing will now stop rather than be
deleted.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@688 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-05-13 00:18:50 +00:00
parent 65f3dda9ab
commit d4706da4d5
22 changed files with 177 additions and 346 deletions
+3 -3
View File
@@ -90,7 +90,7 @@ DownloadList::DownloadList(Control* c) :
receive_change_view("main");
if (m_view == NULL)
throw torrent::internal_error("View \"main\" must be present to initialize the main display.");
throw torrent::client_error("View \"main\" must be present to initialize the main display.");
m_taskUpdate.set_slot(rak::mem_fn(this, &DownloadList::task_update)),
@@ -209,7 +209,7 @@ DownloadList::receive_stop_download() {
if (m_view->focus() == m_view->end_visible())
return;
if ((*m_view->focus())->download()->is_active())
if ((*m_view->focus())->variable()->get_value("state") == 1)
m_control->core()->download_list()->stop(*m_view->focus());
else
m_control->core()->download_list()->erase(*m_view->focus());
@@ -391,7 +391,7 @@ DownloadList::receive_change_view(const std::string& name) {
ElementDownloadList* ui = dynamic_cast<ElementDownloadList*>(m_uiArray[DISPLAY_DOWNLOAD_LIST]);
if (ui == NULL)
throw torrent::internal_error("DownloadList::receive_change_view(...) could not cast ui.");
throw torrent::client_error("DownloadList::receive_change_view(...) could not cast ui.");
ui->set_view(m_view);
}
+6 -6
View File
@@ -61,7 +61,7 @@ ElementFileList::ElementFileList(core::Download* d) :
void
ElementFileList::activate(Control* c, MItr mItr) {
if (m_window != NULL)
throw torrent::internal_error("ui::ElementFileList::activate(...) called on an object in the wrong state");
throw torrent::client_error("ui::ElementFileList::activate(...) called on an object in the wrong state");
c->input()->push_front(&m_bindings);
@@ -71,7 +71,7 @@ ElementFileList::activate(Control* c, MItr mItr) {
void
ElementFileList::disable(Control* c) {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementFileList::disable(...) called on an object in the wrong state");
throw torrent::client_error("ui::ElementFileList::disable(...) called on an object in the wrong state");
c->input()->erase(&m_bindings);
@@ -82,7 +82,7 @@ ElementFileList::disable(Control* c) {
void
ElementFileList::receive_next() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementFileList::receive_next(...) called on a disabled object");
throw torrent::client_error("ui::ElementFileList::receive_next(...) called on a disabled object");
if (++m_focus >= m_download->download()->file_list().size())
m_focus = 0;
@@ -93,7 +93,7 @@ ElementFileList::receive_next() {
void
ElementFileList::receive_prev() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList fl = m_download->download()->file_list();
@@ -111,7 +111,7 @@ ElementFileList::receive_prev() {
void
ElementFileList::receive_priority() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList fl = m_download->download()->file_list();
@@ -129,7 +129,7 @@ ElementFileList::receive_priority() {
void
ElementFileList::receive_change_all() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object");
torrent::FileList fl = m_download->download()->file_list();
+7 -7
View File
@@ -62,7 +62,7 @@ ElementTrackerList::ElementTrackerList(core::Download* d) :
void
ElementTrackerList::activate(Control* c, MItr mItr) {
if (m_window != NULL)
throw torrent::internal_error("ui::ElementTrackerList::activate(...) called on an object in the wrong state");
throw torrent::client_error("ui::ElementTrackerList::activate(...) called on an object in the wrong state");
c->input()->push_front(&m_bindings);
@@ -72,7 +72,7 @@ ElementTrackerList::activate(Control* c, MItr mItr) {
void
ElementTrackerList::disable(Control* c) {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementTrackerList::disable(...) called on an object in the wrong state");
throw torrent::client_error("ui::ElementTrackerList::disable(...) called on an object in the wrong state");
c->input()->erase(&m_bindings);
@@ -83,7 +83,7 @@ ElementTrackerList::disable(Control* c) {
void
ElementTrackerList::receive_disable() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
throw torrent::client_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
torrent::Tracker t = m_download->download()->tracker_list().get(m_focus);
@@ -98,7 +98,7 @@ ElementTrackerList::receive_disable() {
void
ElementTrackerList::receive_next() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementTrackerList::receive_next(...) called on a disabled object");
throw torrent::client_error("ui::ElementTrackerList::receive_next(...) called on a disabled object");
if (++m_focus >= m_download->download()->tracker_list().size())
m_focus = 0;
@@ -109,7 +109,7 @@ ElementTrackerList::receive_next() {
void
ElementTrackerList::receive_prev() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object");
throw torrent::client_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object");
if (m_download->download()->tracker_list().size() == 0)
return;
@@ -125,12 +125,12 @@ ElementTrackerList::receive_prev() {
void
ElementTrackerList::receive_cycle_group() {
if (m_window == NULL)
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object");
throw torrent::client_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object");
torrent::TrackerList tl = m_download->download()->tracker_list();
if (m_focus >= tl.size())
throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus");
throw torrent::client_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus");
tl.cycle_group(tl.get(m_focus).group());