mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-11 12:42:31 +00:00
* Set "stopped" stated to newly added torrents, so they stay stopped
when restarting the client. * Renamed Bencode::operator[] to Bencode::get_key. * Added progress percentage for hash checking. * Correctly update the delegator priority when loading resume data with file priorities. * Don't allow file names with '\0' in them. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@597 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -141,7 +141,7 @@ DownloadFactory::receive_success() {
|
||||
if (m_session) {
|
||||
torrent::Bencode& bencode = (*itr)->get_bencode();
|
||||
|
||||
if (bencode["rtorrent"]["state"].as_string() == "started")
|
||||
if (bencode.get_key("rtorrent").get_key("state").as_string() == "started")
|
||||
m_manager->start(*itr);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
// rTorrent - BitTorrent client
|
||||
// Copyright (C) 2005, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
||||
//
|
||||
// Skomakerveien 33
|
||||
// 3185 Skoppum, NORWAY
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <torrent/torrent.h>
|
||||
|
||||
#include "downloads.h"
|
||||
|
||||
namespace engine {
|
||||
|
||||
void
|
||||
Downloads::create(std::istream& str) {
|
||||
torrent::Download d = torrent::download_create(str);
|
||||
|
||||
Base::push_back(d);
|
||||
}
|
||||
|
||||
void
|
||||
Downloads::erase(iterator itr) {
|
||||
torrent::download_remove(itr->get_hash());
|
||||
|
||||
Base::erase(itr);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
// rTorrent - BitTorrent client
|
||||
// Copyright (C) 2005, Jari Sundell
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// In addition, as a special exception, the copyright holders give
|
||||
// permission to link the code of portions of this program with the
|
||||
// OpenSSL library under certain conditions as described in each
|
||||
// individual source file, and distribute linked combinations
|
||||
// including the two.
|
||||
//
|
||||
// You must obey the GNU General Public License in all respects for
|
||||
// all of the code used other than OpenSSL. If you modify file(s)
|
||||
// with this exception, you may extend this exception to your version
|
||||
// of the file(s), but you are not obligated to do so. If you do not
|
||||
// wish to do so, delete this exception statement from your version.
|
||||
// If you delete this exception statement from all source files in the
|
||||
// program, then also delete it here.
|
||||
//
|
||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
||||
//
|
||||
// Skomakerveien 33
|
||||
// 3185 Skoppum, NORWAY
|
||||
|
||||
#ifndef RTORRENT_ENGINE_DOWNLOADS_H
|
||||
#define RTORRENT_ENGINE_DOWNLOADS_H
|
||||
|
||||
#include <iosfwd>
|
||||
#include <torrent/download.h>
|
||||
|
||||
namespace engine {
|
||||
|
||||
class Downloads : private std::list<torrent::Download> {
|
||||
public:
|
||||
typedef std::list<torrent::Download> Base;
|
||||
|
||||
using Base::iterator;
|
||||
using Base::const_iterator;
|
||||
using Base::reverse_iterator;
|
||||
using Base::const_reverse_iterator;
|
||||
|
||||
using Base::begin;
|
||||
using Base::end;
|
||||
using Base::rbegin;
|
||||
using Base::rend;
|
||||
|
||||
void create(std::istream& str);
|
||||
void erase(iterator itr);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+6
-6
@@ -176,7 +176,7 @@ Manager::erase(DListItr itr) {
|
||||
void
|
||||
Manager::start(Download* d) {
|
||||
try {
|
||||
d->get_bencode()["rtorrent"]["state"] = "started";
|
||||
d->get_bencode().get_key("rtorrent").get_key("state") = "started";
|
||||
|
||||
if (d->get_download().is_active())
|
||||
return;
|
||||
@@ -199,7 +199,7 @@ Manager::start(Download* d) {
|
||||
void
|
||||
Manager::stop(Download* d) {
|
||||
try {
|
||||
d->get_bencode()["rtorrent"]["state"] = "stopped";
|
||||
d->get_bencode().get_key("rtorrent").get_key("state") = "stopped";
|
||||
|
||||
m_downloadList.stop(d);
|
||||
|
||||
@@ -265,12 +265,12 @@ Manager::initialize_bencode(Download* d) {
|
||||
torrent::Bencode& bencode = d->get_bencode();
|
||||
|
||||
if (!bencode.has_key("rtorrent") ||
|
||||
!bencode["rtorrent"].is_map())
|
||||
!bencode.get_key("rtorrent").is_map())
|
||||
bencode.insert_key("rtorrent", torrent::Bencode(torrent::Bencode::TYPE_MAP));
|
||||
|
||||
if (!bencode["rtorrent"].has_key("state") ||
|
||||
!bencode["rtorrent"]["state"].is_string())
|
||||
bencode["rtorrent"].insert_key("state", "started");
|
||||
if (!bencode.get_key("rtorrent").has_key("state") ||
|
||||
!bencode.get_key("rtorrent").get_key("state").is_string())
|
||||
bencode.get_key("rtorrent").insert_key("state", "stopped");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -119,7 +119,8 @@ print_download_status(char* buf, unsigned int length, core::Download* d) {
|
||||
buf += std::max(0, snprintf(buf, length, "Inactive: "));
|
||||
|
||||
if (d->get_download().is_hash_checking())
|
||||
buf += std::max(0, snprintf(buf, length, "Checking hash"));
|
||||
buf += std::max(0, snprintf(buf, length, "Checking hash [%2i%%]",
|
||||
(d->get_download().chunks_hashed() * 100) / d->get_download().chunks_total()));
|
||||
|
||||
else if (d->get_download().is_tracker_busy() &&
|
||||
d->get_download().tracker_focus() < d->get_download().size_trackers())
|
||||
|
||||
Reference in New Issue
Block a user