From fb4fa2074469776145a0cd5b8cd3722ae9400f6b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 27 Oct 2003 15:43:33 +0000 Subject: [PATCH] *** empty log message *** --- Jamfile | 7 +++++-- include/libtorrent/torrent.hpp | 10 +++------- src/session.cpp | 18 ++++++++++++++---- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Jamfile b/Jamfile index dbfb67aa8..02863d47c 100755 --- a/Jamfile +++ b/Jamfile @@ -1,3 +1,6 @@ + +project boost : $(BOOST_ROOT) ; + SOURCES = entry.cpp peer_connection.cpp @@ -29,8 +32,8 @@ lib torrent exe client_test : examples/client_test.cpp torrent -# $(BOOST_ROOT)/libs/filesystem/build/boost_filesystem -# $(BOOST_ROOT)/libs/thread/build/boost_thread + @boost/libs/filesystem/build/boost_filesystem + @boost/libs/thread/build/boost_thread : $(BOOST_ROOT) $(BOOST_ROOT) ./include diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index c603457e9..7d74f771b 100755 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -82,17 +82,13 @@ namespace libtorrent public: torrent(detail::session_impl* ses, const torrent_info& torrent_file); - - ~torrent() - { - int i = 0; - } + ~torrent() {} void abort() { m_abort = true; m_event = event_stopped; } bool is_aborted() const { return m_abort; } - // returns the number of seconds left until we are to make - // another tracker-request + // returns true if it time for this torrent to make another + // tracker request bool should_request() const throw() { boost::posix_time::time_duration d = m_next_request - boost::posix_time::second_clock::local_time(); diff --git a/src/session.cpp b/src/session.cpp index 5e2ee3bfe..af5ce78dc 100755 --- a/src/session.cpp +++ b/src/session.cpp @@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include #include @@ -88,7 +89,7 @@ namespace libtorrent // libtorrent's fingerprint unsigned char fingerprint[] = "lt."; - const int len2 = std::min(cl_fprint.length(), (long)7); + const int len2 = std::min(cl_fprint.length(), (std::size_t)7); const int len1 = (len2 == 0?2:3); const int len3 = 12 - len1 - len2; @@ -402,11 +403,20 @@ namespace libtorrent } } + // the return value from this function is valid only as long as the + // session is locked! torrent* session_impl::find_torrent(const sha1_hash& info_hash) { - std::map >::iterator i = m_torrents.find(info_hash); - if (i == m_torrents.end()) return 0; - return boost::get_pointer(i->second); + std::map >::iterator i + = m_torrents.find(info_hash); + if (i != m_torrents.end()) return boost::get_pointer(i->second); + + std::map >::iterator j + = m_checkers.find(info_hash); + if (j != m_checkers.end()) + return boost::get_pointer(j->second->torrent_ptr); + + return 0; }