*** empty log message ***

This commit is contained in:
Arvid Norberg 2003-10-27 15:43:33 +00:00
parent fca86964f8
commit fb4fa20744
3 changed files with 22 additions and 13 deletions

View File

@ -1,3 +1,6 @@
project boost : $(BOOST_ROOT) ;
SOURCES = SOURCES =
entry.cpp entry.cpp
peer_connection.cpp peer_connection.cpp
@ -29,8 +32,8 @@ lib torrent
exe client_test exe client_test
: examples/client_test.cpp : examples/client_test.cpp
<lib>torrent <lib>torrent
# <lib>$(BOOST_ROOT)/libs/filesystem/build/boost_filesystem @boost/libs/filesystem/build/boost_filesystem
# <dll>$(BOOST_ROOT)/libs/thread/build/boost_thread @boost/libs/thread/build/boost_thread
: <include>$(BOOST_ROOT) : <include>$(BOOST_ROOT)
<sysinclude>$(BOOST_ROOT) <sysinclude>$(BOOST_ROOT)
<include>./include <include>./include

View File

@ -82,17 +82,13 @@ namespace libtorrent
public: public:
torrent(detail::session_impl* ses, const torrent_info& torrent_file); torrent(detail::session_impl* ses, const torrent_info& torrent_file);
~torrent() {}
~torrent()
{
int i = 0;
}
void abort() { m_abort = true; m_event = event_stopped; } void abort() { m_abort = true; m_event = event_stopped; }
bool is_aborted() const { return m_abort; } bool is_aborted() const { return m_abort; }
// returns the number of seconds left until we are to make // returns true if it time for this torrent to make another
// another tracker-request // tracker request
bool should_request() const throw() bool should_request() const throw()
{ {
boost::posix_time::time_duration d = m_next_request - boost::posix_time::second_clock::local_time(); boost::posix_time::time_duration d = m_next_request - boost::posix_time::second_clock::local_time();

View File

@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <algorithm> #include <algorithm>
#include <set> #include <set>
#include <cctype> #include <cctype>
#include <algorithm>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
@ -88,7 +89,7 @@ namespace libtorrent
// libtorrent's fingerprint // libtorrent's fingerprint
unsigned char fingerprint[] = "lt."; 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 len1 = (len2 == 0?2:3);
const int len3 = 12 - len1 - len2; 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) torrent* session_impl::find_torrent(const sha1_hash& info_hash)
{ {
std::map<sha1_hash, boost::shared_ptr<torrent> >::iterator i = m_torrents.find(info_hash); std::map<sha1_hash, boost::shared_ptr<torrent> >::iterator i
if (i == m_torrents.end()) return 0; = m_torrents.find(info_hash);
return boost::get_pointer(i->second); if (i != m_torrents.end()) return boost::get_pointer(i->second);
std::map<sha1_hash, boost::shared_ptr<detail::piece_checker_data> >::iterator j
= m_checkers.find(info_hash);
if (j != m_checkers.end())
return boost::get_pointer(j->second->torrent_ptr);
return 0;
} }