mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-17 23:52:30 +00:00
Deletes torrents in the session directory when they are removed.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@293 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -20,13 +20,14 @@ DownloadList::insert(std::istream* str) {
|
||||
return itr;
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::iterator
|
||||
DownloadList::erase(iterator itr) {
|
||||
(*itr)->release_download();
|
||||
|
||||
torrent::download_remove((*itr)->get_hash());
|
||||
delete *itr;
|
||||
Base::erase(itr);
|
||||
|
||||
return Base::erase(itr);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
~DownloadList() { clear(); }
|
||||
|
||||
iterator insert(std::istream* str);
|
||||
void erase(iterator itr);
|
||||
iterator erase(iterator itr);
|
||||
|
||||
private:
|
||||
void clear();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
#include <torrent/bencode.h>
|
||||
#include <torrent/torrent.h>
|
||||
|
||||
@@ -30,6 +31,9 @@ DownloadStore::disable() {
|
||||
|
||||
void
|
||||
DownloadStore::save(Download* d) {
|
||||
if (!is_active())
|
||||
return;
|
||||
|
||||
std::fstream f(create_filename(d).c_str(), std::ios::out | std::ios::trunc);
|
||||
|
||||
if (!f.is_open())
|
||||
@@ -43,6 +47,10 @@ DownloadStore::save(Download* d) {
|
||||
|
||||
void
|
||||
DownloadStore::remove(Download* d) {
|
||||
if (!is_active())
|
||||
return;
|
||||
|
||||
unlink(create_filename(d).c_str());
|
||||
}
|
||||
|
||||
std::string
|
||||
|
||||
+6
-4
@@ -39,15 +39,17 @@ Manager::insert(const std::string& uri) {
|
||||
create_http(uri);
|
||||
}
|
||||
|
||||
void
|
||||
Manager::iterator
|
||||
Manager::erase(DownloadList::iterator itr) {
|
||||
if ((*itr)->get_download().is_active())
|
||||
throw std::logic_error("core::Manager::erase(...) called on an active download");
|
||||
|
||||
if ((*itr)->get_download().is_open())
|
||||
(*itr)->close();
|
||||
if (!(*itr)->get_download().is_open())
|
||||
throw std::logic_error("core::Manager::erase(...) called on an closed download");
|
||||
|
||||
m_downloadList.erase(itr);
|
||||
m_downloadStore.remove(*itr);
|
||||
|
||||
return m_downloadList.erase(itr);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+2
-1
@@ -11,6 +11,7 @@ namespace core {
|
||||
|
||||
class Manager {
|
||||
public:
|
||||
typedef DownloadList::iterator iterator;
|
||||
typedef sigc::slot1<void, DownloadList::iterator> SlotReady;
|
||||
typedef sigc::slot0<void> SlotFailed;
|
||||
|
||||
@@ -27,7 +28,7 @@ public:
|
||||
void cleanup();
|
||||
|
||||
void insert(const std::string& uri);
|
||||
void erase(DownloadList::iterator itr);
|
||||
iterator erase(DownloadList::iterator itr);
|
||||
|
||||
void start(Download* d);
|
||||
void stop(Download* d);
|
||||
|
||||
@@ -27,7 +27,7 @@ WindowPeerInfo::redraw() {
|
||||
|
||||
int y = 0;
|
||||
|
||||
m_canvas->print(0, y++, "Hash: %s", utils::escape_string(m_download->get_download().get_hash()).c_str());
|
||||
m_canvas->print(0, y++, "Hash: %s", utils::string_to_hex(m_download->get_download().get_hash()).c_str());
|
||||
m_canvas->print(0, y++, "Chunks: %u / %u * %u",
|
||||
m_download->get_download().get_chunks_done(),
|
||||
m_download->get_download().get_chunks_total(),
|
||||
|
||||
@@ -123,7 +123,7 @@ DownloadList::receive_stop_download() {
|
||||
if ((*m_focus)->get_download().is_active())
|
||||
m_control->get_core().stop(*m_focus);
|
||||
else
|
||||
m_control->get_core().erase(m_focus);
|
||||
m_focus = m_control->get_core().erase(m_focus);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user