*** empty log message ***

This commit is contained in:
Arvid Norberg
2004-08-30 09:08:36 +00:00
parent 8b4928d280
commit c609faa879
4 changed files with 18 additions and 26 deletions

View File

@@ -218,7 +218,7 @@ void print_peer_info(std::ostream& out, std::vector<libtorrent::peer_info> const
{ {
using namespace libtorrent; using namespace libtorrent;
out << " down up q r flags block\n"; out << " down up q r flags client block\n";
for (std::vector<peer_info>::const_iterator i = peers.begin(); for (std::vector<peer_info>::const_iterator i = peers.begin();
i != peers.end(); i != peers.end();

View File

@@ -177,7 +177,7 @@ namespace libtorrent
friend class session; friend class session;
friend class torrent; friend class torrent;
torrent_handle(): m_ses(0) {} torrent_handle(): m_ses(0), m_chk(0) {}
void get_peer_info(std::vector<peer_info>& v) const; void get_peer_info(std::vector<peer_info>& v) const;
torrent_status status() const; torrent_status status() const;

View File

@@ -155,6 +155,7 @@ namespace
{ {
map_entry("A", "ABC") map_entry("A", "ABC")
, map_entry("AZ", "Azureus") , map_entry("AZ", "Azureus")
, map_entry("BB", "BitBuddy")
, map_entry("BX", "BittorrentX") , map_entry("BX", "BittorrentX")
, map_entry("LT", "libtorrent") , map_entry("LT", "libtorrent")
, map_entry("M", "Mainline") , map_entry("M", "Mainline")

View File

@@ -840,14 +840,12 @@ namespace libtorrent
throw duplicate_torrent(); throw duplicate_torrent();
} }
{ // lock the checker_thread
// lock the checker_thread boost::mutex::scoped_lock l(m_checker_impl.m_mutex);
boost::mutex::scoped_lock l(m_checker_impl.m_mutex);
// is the torrent currently being checked? // is the torrent currently being checked?
if (m_checker_impl.find_torrent(ti.info_hash())) if (m_checker_impl.find_torrent(ti.info_hash()))
throw duplicate_torrent(); throw duplicate_torrent();
}
// create the torrent and the data associated with // create the torrent and the data associated with
// the checker thread and store it before starting // the checker thread and store it before starting
@@ -861,9 +859,6 @@ namespace libtorrent
d.info_hash = ti.info_hash(); d.info_hash = ti.info_hash();
d.parse_resume_data(resume_data, torrent_ptr->torrent_file()); d.parse_resume_data(resume_data, torrent_ptr->torrent_file());
// lock the checker thread
boost::mutex::scoped_lock l(m_checker_impl.m_mutex);
// add the torrent to the queue to be checked // add the torrent to the queue to be checked
m_checker_impl.m_torrents.push_back(d); m_checker_impl.m_torrents.push_back(d);
// and notify the thread that it got another // and notify the thread that it got another
@@ -880,15 +875,6 @@ namespace libtorrent
, boost::filesystem::path const& save_path , boost::filesystem::path const& save_path
, entry const& resume_data) , entry const& resume_data)
{ {
{
// lock the session
boost::mutex::scoped_lock l(m_impl.m_mutex);
// is the torrent already active?
if (m_impl.find_torrent(info_hash))
throw duplicate_torrent();
}
{ {
// lock the checker_thread // lock the checker_thread
boost::mutex::scoped_lock l(m_checker_impl.m_mutex); boost::mutex::scoped_lock l(m_checker_impl.m_mutex);
@@ -898,13 +884,19 @@ namespace libtorrent
throw duplicate_torrent(); throw duplicate_torrent();
} }
// lock the session
boost::mutex::scoped_lock l(m_impl.m_mutex);
// is the torrent already active?
if (m_impl.find_torrent(info_hash))
throw duplicate_torrent();
// create the torrent and the data associated with // create the torrent and the data associated with
// the checker thread and store it before starting // the checker thread and store it before starting
// the thread // the thread
boost::shared_ptr<torrent> torrent_ptr( boost::shared_ptr<torrent> torrent_ptr(
new torrent(m_impl, tracker_url, info_hash, save_path, m_impl.m_listen_interface)); new torrent(m_impl, tracker_url, info_hash, save_path, m_impl.m_listen_interface));
boost::mutex::scoped_lock l(m_impl.m_mutex);
m_impl.m_torrents.insert( m_impl.m_torrents.insert(
std::make_pair(info_hash, torrent_ptr)).first; std::make_pair(info_hash, torrent_ptr)).first;
@@ -1006,6 +998,7 @@ namespace libtorrent
session::~session() session::~session()
{ {
{ {
// lock the main thread and abort it
boost::mutex::scoped_lock l(m_impl.m_mutex); boost::mutex::scoped_lock l(m_impl.m_mutex);
m_impl.m_abort = true; m_impl.m_abort = true;
} }
@@ -1032,8 +1025,7 @@ namespace libtorrent
assert(bytes_per_second > 0 || bytes_per_second == -1); assert(bytes_per_second > 0 || bytes_per_second == -1);
boost::mutex::scoped_lock l(m_impl.m_mutex); boost::mutex::scoped_lock l(m_impl.m_mutex);
m_impl.m_upload_rate = bytes_per_second; m_impl.m_upload_rate = bytes_per_second;
if (m_impl.m_upload_rate != -1/* || !m_impl.m_connections.empty()*/) if (m_impl.m_upload_rate != -1) return;
return;
for (detail::session_impl::connection_map::iterator i for (detail::session_impl::connection_map::iterator i
= m_impl.m_connections.begin(); = m_impl.m_connections.begin();
@@ -1048,8 +1040,7 @@ namespace libtorrent
assert(bytes_per_second > 0 || bytes_per_second == -1); assert(bytes_per_second > 0 || bytes_per_second == -1);
boost::mutex::scoped_lock l(m_impl.m_mutex); boost::mutex::scoped_lock l(m_impl.m_mutex);
m_impl.m_download_rate = bytes_per_second; m_impl.m_download_rate = bytes_per_second;
if (m_impl.m_download_rate != -1/* || !m_impl.m_connections.empty()*/) if (m_impl.m_download_rate != -1) return;
return;
for (detail::session_impl::connection_map::iterator i for (detail::session_impl::connection_map::iterator i
= m_impl.m_connections.begin(); = m_impl.m_connections.begin();