*** empty log message ***
This commit is contained in:
parent
f324cc925e
commit
a8e8c715e8
|
@ -57,8 +57,8 @@ example client.</p>
|
||||||
<p>There's a <a class="reference" href="http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss">mailing list</a>, general libtorrent discussion.</p>
|
<p>There's a <a class="reference" href="http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss">mailing list</a>, general libtorrent discussion.</p>
|
||||||
<p>You can usually find me as hydri in <tt class="literal"><span class="pre">#btports</span> <span class="pre">@</span> <span class="pre">irc.freenode.net</span></tt>.</p>
|
<p>You can usually find me as hydri in <tt class="literal"><span class="pre">#btports</span> <span class="pre">@</span> <span class="pre">irc.freenode.net</span></tt>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="aknowledgements">
|
<div class="section" id="acknowledgements">
|
||||||
<h1><a name="aknowledgements">Aknowledgements</a></h1>
|
<h1><a name="acknowledgements">Acknowledgements</a></h1>
|
||||||
<p>Written by Arvid Norberg. Copyright (c) 2003</p>
|
<p>Written by Arvid Norberg. Copyright (c) 2003</p>
|
||||||
<p>Contributions by Magnus Jonsson and Daniel Wallin</p>
|
<p>Contributions by Magnus Jonsson and Daniel Wallin</p>
|
||||||
<p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p>
|
<p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p>
|
||||||
|
|
|
@ -58,7 +58,7 @@ You can usually find me as hydri in ``#btports @ irc.freenode.net``.
|
||||||
|
|
||||||
|
|
||||||
Acknowledgements
|
Acknowledgements
|
||||||
===============
|
================
|
||||||
|
|
||||||
Written by Arvid Norberg. Copyright (c) 2003
|
Written by Arvid Norberg. Copyright (c) 2003
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference" href="#filename-checks" id="id96" name="id96">filename checks</a></li>
|
<li><a class="reference" href="#filename-checks" id="id96" name="id96">filename checks</a></li>
|
||||||
<li><a class="reference" href="#aknowledgements" id="id97" name="id97">aknowledgements</a></li>
|
<li><a class="reference" href="#acknowledgements" id="id97" name="id97">acknowledgements</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="introduction">
|
<div class="section" id="introduction">
|
||||||
|
@ -635,11 +635,13 @@ class torrent_info
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
torrent_info(entry const& torrent_file)
|
torrent_info();
|
||||||
torrent_info(int piece_size, const char* name);
|
torrent_info(sha1_hash const& info_hash);
|
||||||
|
torrent_info(entry const& torrent_file);
|
||||||
|
|
||||||
entry create_torrent() const;
|
entry create_torrent() const;
|
||||||
void set_comment(char const* str);
|
void set_comment(char const* str);
|
||||||
|
void set_piece_size(int size);
|
||||||
void set_creator(char const* str);
|
void set_creator(char const* str);
|
||||||
void set_hash(int index, const sha1_hash& h);
|
void set_hash(int index, const sha1_hash& h);
|
||||||
void add_tracker(std::string const& url, int tier = 0);
|
void add_tracker(std::string const& url, int tier = 0);
|
||||||
|
@ -2326,8 +2328,8 @@ boost::filesystem::path::default_name_check(boost::filesystem::native);
|
||||||
</pre>
|
</pre>
|
||||||
<p>for example. For more information, see the <a class="reference" href="http://www.boost.org/libs/filesystem/doc/index.htm">Boost.Filesystem docs</a>.</p>
|
<p>for example. For more information, see the <a class="reference" href="http://www.boost.org/libs/filesystem/doc/index.htm">Boost.Filesystem docs</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="aknowledgements">
|
<div class="section" id="acknowledgements">
|
||||||
<h1><a name="aknowledgements">aknowledgements</a></h1>
|
<h1><a name="acknowledgements">acknowledgements</a></h1>
|
||||||
<p>Written by Arvid Norberg. Copyright (c) 2003</p>
|
<p>Written by Arvid Norberg. Copyright (c) 2003</p>
|
||||||
<p>Contributions by Magnus Jonsson and Daniel Wallin</p>
|
<p>Contributions by Magnus Jonsson and Daniel Wallin</p>
|
||||||
<p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p>
|
<p>Thanks to Reimond Retz for bugfixes, suggestions and testing</p>
|
||||||
|
|
|
@ -559,11 +559,13 @@ The ``torrent_info`` has the following synopsis::
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
torrent_info(entry const& torrent_file)
|
torrent_info();
|
||||||
torrent_info(int piece_size, const char* name);
|
torrent_info(sha1_hash const& info_hash);
|
||||||
|
torrent_info(entry const& torrent_file);
|
||||||
|
|
||||||
entry create_torrent() const;
|
entry create_torrent() const;
|
||||||
void set_comment(char const* str);
|
void set_comment(char const* str);
|
||||||
|
void set_piece_size(int size);
|
||||||
void set_creator(char const* str);
|
void set_creator(char const* str);
|
||||||
void set_hash(int index, const sha1_hash& h);
|
void set_hash(int index, const sha1_hash& h);
|
||||||
void add_tracker(std::string const& url, int tier = 0);
|
void add_tracker(std::string const& url, int tier = 0);
|
||||||
|
@ -2318,7 +2320,7 @@ __ http://www.boost.org/libs/filesystem/doc/index.htm
|
||||||
|
|
||||||
|
|
||||||
acknowledgements
|
acknowledgements
|
||||||
===============
|
================
|
||||||
|
|
||||||
Written by Arvid Norberg. Copyright (c) 2003
|
Written by Arvid Norberg. Copyright (c) 2003
|
||||||
|
|
||||||
|
|
|
@ -36,5 +36,5 @@ exe make_torrent
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
stage bin : dump_torrent simple_client client_test make_torrent ;
|
stage bin : dump_torrent make_torrent simple_client client_test ;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
{
|
{
|
||||||
std::cerr << "usage: ./simple_cient torrent-file\n"
|
std::cerr << "usage: ./simple_client torrent-file\n"
|
||||||
"to stop the client, press return.\n";
|
"to stop the client, press return.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
#include <boost/filesystem/convenience.hpp>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
|
@ -102,11 +104,11 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
file_logger(const char* filename)
|
file_logger(const char* filename)
|
||||||
: m_file(filename)
|
: m_file(boost::filesystem::complete(filename))
|
||||||
{ assert(filename); }
|
{ assert(filename); }
|
||||||
virtual void log(const char* text) { assert(text); m_file << text; }
|
virtual void log(const char* text) { assert(text); m_file << text; }
|
||||||
|
|
||||||
std::ofstream m_file;
|
boost::filesystem::ofstream m_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ namespace libtorrent
|
||||||
|
|
||||||
return p.connection == 0
|
return p.connection == 0
|
||||||
&& p.connected != not_tried_yet
|
&& p.connected != not_tried_yet
|
||||||
&& second_clock::local_time() - p.connected > minutes(30);
|
&& second_clock::universal_time() - p.connected > minutes(30);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -486,7 +486,7 @@ namespace libtorrent
|
||||||
inline void torrent::force_tracker_request()
|
inline void torrent::force_tracker_request()
|
||||||
{
|
{
|
||||||
namespace time = boost::posix_time;
|
namespace time = boost::posix_time;
|
||||||
m_next_request = time::second_clock::local_time();
|
m_next_request = time::second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void torrent::set_tracker_login(
|
inline void torrent::set_tracker_login(
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace libtorrent {
|
||||||
alert::alert(severity_t severity, const std::string& msg)
|
alert::alert(severity_t severity, const std::string& msg)
|
||||||
: m_msg(msg)
|
: m_msg(msg)
|
||||||
, m_severity(severity)
|
, m_severity(severity)
|
||||||
, m_timestamp(boost::posix_time::second_clock::local_time())
|
, m_timestamp(boost::posix_time::second_clock::universal_time())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ namespace
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -90,7 +92,7 @@ namespace libtorrent
|
||||||
, m_content_encoding(plain)
|
, m_content_encoding(plain)
|
||||||
, m_content_length(0)
|
, m_content_length(0)
|
||||||
, m_recv_pos(0)
|
, m_recv_pos(0)
|
||||||
, m_request_time(boost::posix_time::second_clock::local_time())
|
, m_request_time(second_clock::universal_time())
|
||||||
, m_settings(stn)
|
, m_settings(stn)
|
||||||
, m_req(req)
|
, m_req(req)
|
||||||
, m_password(password)
|
, m_password(password)
|
||||||
|
@ -213,7 +215,7 @@ namespace libtorrent
|
||||||
|
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
time_duration d = second_clock::local_time() - m_request_time;
|
time_duration d = second_clock::universal_time() - m_request_time;
|
||||||
if (d > seconds(m_settings.tracker_timeout) ||
|
if (d > seconds(m_settings.tracker_timeout) ||
|
||||||
(!has_requester() && d > seconds(m_settings.stop_tracker_timeout)))
|
(!has_requester() && d > seconds(m_settings.stop_tracker_timeout)))
|
||||||
{
|
{
|
||||||
|
@ -247,7 +249,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sent != 0)
|
if (sent != 0)
|
||||||
m_request_time = boost::posix_time::second_clock::local_time();
|
m_request_time = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_socket->has_error())
|
if (m_socket->has_error())
|
||||||
|
@ -260,7 +262,7 @@ namespace libtorrent
|
||||||
// if the socket isn't ready for reading, there's no point in continuing
|
// if the socket isn't ready for reading, there's no point in continuing
|
||||||
// trying to read from it
|
// trying to read from it
|
||||||
if (!m_socket->is_readable()) return false;
|
if (!m_socket->is_readable()) return false;
|
||||||
m_request_time = boost::posix_time::second_clock::local_time();
|
m_request_time = second_clock::universal_time();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (has_requester()) requester().debug_log("tracker connection socket readable");
|
if (has_requester()) requester().debug_log("tracker connection socket readable");
|
||||||
|
|
|
@ -56,6 +56,8 @@ namespace std
|
||||||
|
|
||||||
#define VERBOSE
|
#define VERBOSE
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -90,8 +92,8 @@ namespace libtorrent
|
||||||
, m_timeout(120)
|
, m_timeout(120)
|
||||||
, m_packet_size(1)
|
, m_packet_size(1)
|
||||||
, m_recv_pos(0)
|
, m_recv_pos(0)
|
||||||
, m_last_receive(boost::posix_time::second_clock::local_time())
|
, m_last_receive(second_clock::universal_time())
|
||||||
, m_last_sent(boost::posix_time::second_clock::local_time())
|
, m_last_sent(second_clock::universal_time())
|
||||||
, m_selector(sel)
|
, m_selector(sel)
|
||||||
, m_socket(s)
|
, m_socket(s)
|
||||||
, m_torrent(t)
|
, m_torrent(t)
|
||||||
|
@ -110,10 +112,10 @@ namespace libtorrent
|
||||||
, m_free_upload(0)
|
, m_free_upload(0)
|
||||||
, m_trust_points(0)
|
, m_trust_points(0)
|
||||||
, m_num_invalid_requests(0)
|
, m_num_invalid_requests(0)
|
||||||
, m_last_piece(boost::posix_time::second_clock::local_time())
|
, m_last_piece(second_clock::universal_time())
|
||||||
, m_disconnecting(false)
|
, m_disconnecting(false)
|
||||||
, m_became_uninterested(boost::posix_time::second_clock::local_time())
|
, m_became_uninterested(second_clock::universal_time())
|
||||||
, m_became_uninteresting(boost::posix_time::second_clock::local_time())
|
, m_became_uninteresting(second_clock::universal_time())
|
||||||
, m_no_metadata(
|
, m_no_metadata(
|
||||||
boost::gregorian::date(1970, boost::date_time::Jan, 1)
|
boost::gregorian::date(1970, boost::date_time::Jan, 1)
|
||||||
, boost::posix_time::seconds(0))
|
, boost::posix_time::seconds(0))
|
||||||
|
@ -167,8 +169,8 @@ namespace libtorrent
|
||||||
, m_timeout(120)
|
, m_timeout(120)
|
||||||
, m_packet_size(1)
|
, m_packet_size(1)
|
||||||
, m_recv_pos(0)
|
, m_recv_pos(0)
|
||||||
, m_last_receive(boost::posix_time::second_clock::local_time())
|
, m_last_receive(second_clock::universal_time())
|
||||||
, m_last_sent(boost::posix_time::second_clock::local_time())
|
, m_last_sent(second_clock::universal_time())
|
||||||
, m_selector(sel)
|
, m_selector(sel)
|
||||||
, m_socket(s)
|
, m_socket(s)
|
||||||
, m_torrent(0)
|
, m_torrent(0)
|
||||||
|
@ -188,10 +190,10 @@ namespace libtorrent
|
||||||
, m_free_upload(0)
|
, m_free_upload(0)
|
||||||
, m_trust_points(0)
|
, m_trust_points(0)
|
||||||
, m_num_invalid_requests(0)
|
, m_num_invalid_requests(0)
|
||||||
, m_last_piece(boost::posix_time::second_clock::local_time())
|
, m_last_piece(second_clock::universal_time())
|
||||||
, m_disconnecting(false)
|
, m_disconnecting(false)
|
||||||
, m_became_uninterested(boost::posix_time::second_clock::local_time())
|
, m_became_uninterested(second_clock::universal_time())
|
||||||
, m_became_uninteresting(boost::posix_time::second_clock::local_time())
|
, m_became_uninteresting(second_clock::universal_time())
|
||||||
, m_no_metadata(
|
, m_no_metadata(
|
||||||
boost::gregorian::date(1970, boost::date_time::Jan, 1)
|
boost::gregorian::date(1970, boost::date_time::Jan, 1)
|
||||||
, boost::posix_time::seconds(0))
|
, boost::posix_time::seconds(0))
|
||||||
|
@ -431,7 +433,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> HANDSHAKE\n";
|
<< " ==> HANDSHAKE\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -503,7 +505,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== CHOKE\n";
|
<< " <== CHOKE\n";
|
||||||
#endif
|
#endif
|
||||||
m_peer_choked = true;
|
m_peer_choked = true;
|
||||||
|
@ -539,7 +541,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== UNCHOKE\n";
|
<< " <== UNCHOKE\n";
|
||||||
#endif
|
#endif
|
||||||
m_peer_choked = false;
|
m_peer_choked = false;
|
||||||
|
@ -562,7 +564,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== INTERESTED\n";
|
<< " <== INTERESTED\n";
|
||||||
#endif
|
#endif
|
||||||
m_peer_interested = true;
|
m_peer_interested = true;
|
||||||
|
@ -583,7 +585,7 @@ namespace libtorrent
|
||||||
m_statistics.received_bytes(0, received);
|
m_statistics.received_bytes(0, received);
|
||||||
if (m_recv_pos < m_packet_size) return;
|
if (m_recv_pos < m_packet_size) return;
|
||||||
|
|
||||||
m_became_uninterested = boost::posix_time::second_clock::local_time();
|
m_became_uninterested = second_clock::universal_time();
|
||||||
|
|
||||||
// clear the request queue if the client isn't interested
|
// clear the request queue if the client isn't interested
|
||||||
m_requests.clear();
|
m_requests.clear();
|
||||||
|
@ -591,7 +593,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== NOT_INTERESTED\n";
|
<< " <== NOT_INTERESTED\n";
|
||||||
#endif
|
#endif
|
||||||
m_peer_interested = false;
|
m_peer_interested = false;
|
||||||
|
@ -620,7 +622,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== HAVE [ piece: " << index << "]\n";
|
<< " <== HAVE [ piece: " << index << "]\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -673,7 +675,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== BITFIELD\n";
|
<< " <== BITFIELD\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -769,7 +771,7 @@ namespace libtorrent
|
||||||
// we shouldn't get a request
|
// we shouldn't get a request
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== UNEXPECTED_REQUEST [ "
|
<< " <== UNEXPECTED_REQUEST [ "
|
||||||
"piece: " << r.piece << " | "
|
"piece: " << r.piece << " | "
|
||||||
"s: " << r.start << " | "
|
"s: " << r.start << " | "
|
||||||
|
@ -789,7 +791,7 @@ namespace libtorrent
|
||||||
// is making too many of them.
|
// is making too many of them.
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== TOO MANY REQUESTS [ "
|
<< " <== TOO MANY REQUESTS [ "
|
||||||
"piece: " << r.piece << " | "
|
"piece: " << r.piece << " | "
|
||||||
"s: " << r.start << " | "
|
"s: " << r.start << " | "
|
||||||
|
@ -822,7 +824,7 @@ namespace libtorrent
|
||||||
send_buffer_updated();
|
send_buffer_updated();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== REQUEST [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
|
<< " <== REQUEST [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -830,7 +832,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== INVALID_REQUEST [ "
|
<< " <== INVALID_REQUEST [ "
|
||||||
"piece: " << r.piece << " | "
|
"piece: " << r.piece << " | "
|
||||||
"s: " << r.start << " | "
|
"s: " << r.start << " | "
|
||||||
|
@ -865,7 +867,7 @@ namespace libtorrent
|
||||||
assert(received > 0);
|
assert(received > 0);
|
||||||
if (m_recv_pos - received <= 9)
|
if (m_recv_pos - received <= 9)
|
||||||
{
|
{
|
||||||
m_last_piece = boost::posix_time::second_clock::local_time();
|
m_last_piece = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
// classify the received data as protocol chatter
|
// classify the received data as protocol chatter
|
||||||
// or data payload for the statistics
|
// or data payload for the statistics
|
||||||
|
@ -898,7 +900,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== INVALID_PIECE [ piece: " << p.piece << " | "
|
<< " <== INVALID_PIECE [ piece: " << p.piece << " | "
|
||||||
"start: " << p.start << " | "
|
"start: " << p.start << " | "
|
||||||
"length: " << p.length << " ]\n";
|
"length: " << p.length << " ]\n";
|
||||||
|
@ -916,11 +918,11 @@ namespace libtorrent
|
||||||
&& i->block_index == p.start / m_torrent->block_size())
|
&& i->block_index == p.start / m_torrent->block_size())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " *** SKIPPED_PIECE [ piece: " << i->piece_index << " | "
|
<< " *** SKIPPED_PIECE [ piece: " << i->piece_index << " | "
|
||||||
"b: " << i->block_index << " ] ***\n";
|
"b: " << i->block_index << " ] ***\n";
|
||||||
}
|
}
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== PIECE [ piece: " << p.piece << " | "
|
<< " <== PIECE [ piece: " << p.piece << " | "
|
||||||
"b: " << p.start / m_torrent->block_size() << " | "
|
"b: " << p.start / m_torrent->block_size() << " | "
|
||||||
"s: " << p.start << " | "
|
"s: " << p.start << " | "
|
||||||
|
@ -1040,7 +1042,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== CANCEL [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
|
<< " <== CANCEL [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1223,7 +1225,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " <== METADATA [ tot: " << total_size << " offset: "
|
<< " <== METADATA [ tot: " << total_size << " offset: "
|
||||||
<< offset << " size: " << data_size << " ]\n";
|
<< offset << " size: " << data_size << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
|
@ -1234,7 +1236,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // have no data
|
case 2: // have no data
|
||||||
m_no_metadata = boost::posix_time::second_clock::local_time();
|
m_no_metadata = second_clock::universal_time();
|
||||||
if (m_waiting_metadata_request)
|
if (m_waiting_metadata_request)
|
||||||
m_torrent->cancel_metadata_request(m_last_metadata_request);
|
m_torrent->cancel_metadata_request(m_last_metadata_request);
|
||||||
m_waiting_metadata_request = false;
|
m_waiting_metadata_request = false;
|
||||||
|
@ -1267,7 +1269,7 @@ namespace libtorrent
|
||||||
if (is_local())
|
if (is_local())
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< "<== LISTEN_PORT [ UNEXPECTED ]\n";
|
<< "<== LISTEN_PORT [ UNEXPECTED ]\n";
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -1277,7 +1279,7 @@ namespace libtorrent
|
||||||
unsigned short port = detail::read_uint16(ptr);
|
unsigned short port = detail::read_uint16(ptr);
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< "<== LISTEN_PORT [ port: " << port << " ]\n";
|
<< "<== LISTEN_PORT [ port: " << port << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1289,7 +1291,7 @@ namespace libtorrent
|
||||||
bool peer_connection::has_metadata() const
|
bool peer_connection::has_metadata() const
|
||||||
{
|
{
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
return second_clock::local_time() - m_no_metadata > minutes(5);
|
return second_clock::universal_time() - m_no_metadata > minutes(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1378,7 +1380,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> CANCEL [ piece: " << block.piece_index << " | s: " << block_offset << " | l: " << block_size << " | " << block.block_index << " ]\n";
|
<< " ==> CANCEL [ piece: " << block.piece_index << " | s: " << block_offset << " | l: " << block_size << " | " << block.block_index << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1426,7 +1428,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> REQUEST [ "
|
<< " ==> REQUEST [ "
|
||||||
"piece: " << block.piece_index << " | "
|
"piece: " << block.piece_index << " | "
|
||||||
"b: " << block.block_index << " | "
|
"b: " << block.block_index << " | "
|
||||||
|
@ -1504,7 +1506,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> METADATA_REQUEST [ start: " << req.first
|
<< " ==> METADATA_REQUEST [ start: " << req.first
|
||||||
<< " size: " << req.second << " ]\n";
|
<< " size: " << req.second << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
|
@ -1550,7 +1552,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> BITFIELD\n";
|
<< " ==> BITFIELD\n";
|
||||||
#endif
|
#endif
|
||||||
const int packet_size = ((int)m_have_piece.size() + 7) / 8 + 5;
|
const int packet_size = ((int)m_have_piece.size() + 7) / 8 + 5;
|
||||||
|
@ -1576,7 +1578,7 @@ namespace libtorrent
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> EXTENSIONS\n";
|
<< " ==> EXTENSIONS\n";
|
||||||
#endif
|
#endif
|
||||||
assert(m_supports_extensions);
|
assert(m_supports_extensions);
|
||||||
|
@ -1613,7 +1615,7 @@ namespace libtorrent
|
||||||
m_choked = true;
|
m_choked = true;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> CHOKE\n";
|
<< " ==> CHOKE\n";
|
||||||
#endif
|
#endif
|
||||||
m_num_invalid_requests = 0;
|
m_num_invalid_requests = 0;
|
||||||
|
@ -1631,7 +1633,7 @@ namespace libtorrent
|
||||||
m_choked = false;
|
m_choked = false;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> UNCHOKE\n";
|
<< " ==> UNCHOKE\n";
|
||||||
#endif
|
#endif
|
||||||
send_buffer_updated();
|
send_buffer_updated();
|
||||||
|
@ -1647,7 +1649,7 @@ namespace libtorrent
|
||||||
m_interesting = true;
|
m_interesting = true;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> INTERESTED\n";
|
<< " ==> INTERESTED\n";
|
||||||
#endif
|
#endif
|
||||||
send_buffer_updated();
|
send_buffer_updated();
|
||||||
|
@ -1662,11 +1664,11 @@ namespace libtorrent
|
||||||
m_send_buffer.insert(m_send_buffer.end(), msg, msg+sizeof(msg));
|
m_send_buffer.insert(m_send_buffer.end(), msg, msg+sizeof(msg));
|
||||||
m_interesting = false;
|
m_interesting = false;
|
||||||
|
|
||||||
m_became_uninteresting = boost::posix_time::second_clock::local_time();
|
m_became_uninteresting = second_clock::universal_time();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> NOT_INTERESTED\n";
|
<< " ==> NOT_INTERESTED\n";
|
||||||
#endif
|
#endif
|
||||||
send_buffer_updated();
|
send_buffer_updated();
|
||||||
|
@ -1690,7 +1692,7 @@ namespace libtorrent
|
||||||
m_send_buffer.insert(m_send_buffer.end(), msg, msg + packet_size);
|
m_send_buffer.insert(m_send_buffer.end(), msg, msg + packet_size);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> HAVE [ piece: " << index << " ]\n";
|
<< " ==> HAVE [ piece: " << index << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
send_buffer_updated();
|
send_buffer_updated();
|
||||||
|
@ -1726,7 +1728,7 @@ namespace libtorrent
|
||||||
m_last_metadata_request = m_torrent->metadata_request();
|
m_last_metadata_request = m_torrent->metadata_request();
|
||||||
send_metadata_request(m_last_metadata_request);
|
send_metadata_request(m_last_metadata_request);
|
||||||
m_waiting_metadata_request = true;
|
m_waiting_metadata_request = true;
|
||||||
m_metadata_request = boost::posix_time::second_clock::local_time();
|
m_metadata_request = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_statistics.second_tick();
|
m_statistics.second_tick();
|
||||||
|
@ -1865,7 +1867,7 @@ namespace libtorrent
|
||||||
|
|
||||||
if (received > 0)
|
if (received > 0)
|
||||||
{
|
{
|
||||||
m_last_receive = boost::posix_time::second_clock::local_time();
|
m_last_receive = second_clock::universal_time();
|
||||||
|
|
||||||
m_recv_pos += received;
|
m_recv_pos += received;
|
||||||
m_dl_bandwidth_quota.used += received;
|
m_dl_bandwidth_quota.used += received;
|
||||||
|
@ -2180,7 +2182,7 @@ namespace libtorrent
|
||||||
, r.length);
|
, r.length);
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> PIECE [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
|
<< " ==> PIECE [ piece: " << r.piece << " | s: " << r.start << " | l: " << r.length << " ]\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2284,7 +2286,7 @@ namespace libtorrent
|
||||||
throw network_error(m_socket->last_error());
|
throw network_error(m_socket->last_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_last_sent = boost::posix_time::second_clock::local_time();
|
m_last_sent = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(m_writability_monitored);
|
assert(m_writability_monitored);
|
||||||
|
@ -2311,7 +2313,7 @@ namespace libtorrent
|
||||||
// if the peer hasn't said a thing for a certain
|
// if the peer hasn't said a thing for a certain
|
||||||
// time, it is considered to have timed out
|
// time, it is considered to have timed out
|
||||||
time_duration d;
|
time_duration d;
|
||||||
d = second_clock::local_time() - m_last_receive;
|
d = second_clock::universal_time() - m_last_receive;
|
||||||
if (d > seconds(m_timeout)) return true;
|
if (d > seconds(m_timeout)) return true;
|
||||||
|
|
||||||
// if the peer hasn't become interested and we haven't
|
// if the peer hasn't become interested and we haven't
|
||||||
|
@ -2319,8 +2321,8 @@ namespace libtorrent
|
||||||
// has also timed out.
|
// has also timed out.
|
||||||
time_duration d1;
|
time_duration d1;
|
||||||
time_duration d2;
|
time_duration d2;
|
||||||
d1 = second_clock::local_time() - m_became_uninterested;
|
d1 = second_clock::universal_time() - m_became_uninterested;
|
||||||
d2 = second_clock::local_time() - m_became_uninteresting;
|
d2 = second_clock::universal_time() - m_became_uninteresting;
|
||||||
if (!m_interesting
|
if (!m_interesting
|
||||||
&& !m_peer_interested
|
&& !m_peer_interested
|
||||||
&& d1 > seconds(60 * 3)
|
&& d1 > seconds(60 * 3)
|
||||||
|
@ -2337,7 +2339,7 @@ namespace libtorrent
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
boost::posix_time::time_duration d;
|
boost::posix_time::time_duration d;
|
||||||
d = boost::posix_time::second_clock::local_time() - m_last_sent;
|
d = second_clock::universal_time() - m_last_sent;
|
||||||
if (d.seconds() < m_timeout / 2) return;
|
if (d.seconds() < m_timeout / 2) return;
|
||||||
|
|
||||||
// we must either send a keep-alive
|
// we must either send a keep-alive
|
||||||
|
@ -2346,10 +2348,10 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
char noop[] = {0,0,0,0};
|
char noop[] = {0,0,0,0};
|
||||||
m_send_buffer.insert(m_send_buffer.end(), noop, noop+4);
|
m_send_buffer.insert(m_send_buffer.end(), noop, noop+4);
|
||||||
m_last_sent = boost::posix_time::second_clock::local_time();
|
m_last_sent = second_clock::universal_time();
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
(*m_logger) << to_simple_string(second_clock::local_time())
|
(*m_logger) << to_simple_string(second_clock::universal_time())
|
||||||
<< " ==> NOP\n";
|
<< " ==> NOP\n";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ namespace libtorrent
|
||||||
class peer_connection;
|
class peer_connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum
|
enum
|
||||||
|
@ -409,7 +411,7 @@ namespace libtorrent
|
||||||
double slowest_transfer_rate = std::numeric_limits<double>::max();
|
double slowest_transfer_rate = std::numeric_limits<double>::max();
|
||||||
|
|
||||||
boost::posix_time::ptime local_time
|
boost::posix_time::ptime local_time
|
||||||
= boost::posix_time::second_clock::local_time();
|
= second_clock::universal_time();
|
||||||
|
|
||||||
for (std::vector<peer>::iterator i = m_peers.begin();
|
for (std::vector<peer>::iterator i = m_peers.begin();
|
||||||
i != m_peers.end();
|
i != m_peers.end();
|
||||||
|
@ -446,7 +448,7 @@ namespace libtorrent
|
||||||
|
|
||||||
policy::peer *policy::find_connect_candidate()
|
policy::peer *policy::find_connect_candidate()
|
||||||
{
|
{
|
||||||
boost::posix_time::ptime local_time=boost::posix_time::second_clock::local_time();
|
boost::posix_time::ptime local_time=second_clock::universal_time();
|
||||||
boost::posix_time::ptime ptime(local_time);
|
boost::posix_time::ptime ptime(local_time);
|
||||||
policy::peer* candidate =0;
|
policy::peer* candidate =0;
|
||||||
|
|
||||||
|
@ -529,7 +531,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
peer* candidate = 0;
|
peer* candidate = 0;
|
||||||
boost::posix_time::ptime last_unchoke
|
boost::posix_time::ptime last_unchoke
|
||||||
= boost::posix_time::second_clock::local_time();
|
= second_clock::universal_time();
|
||||||
|
|
||||||
for (std::vector<peer>::iterator i = m_peers.begin();
|
for (std::vector<peer>::iterator i = m_peers.begin();
|
||||||
i != m_peers.end();
|
i != m_peers.end();
|
||||||
|
@ -554,7 +556,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
p->connection->send_unchoke();
|
p->connection->send_unchoke();
|
||||||
p->last_optimistically_unchoked
|
p->last_optimistically_unchoked
|
||||||
= boost::posix_time::second_clock::local_time();
|
= second_clock::universal_time();
|
||||||
++m_num_unchoked;
|
++m_num_unchoked;
|
||||||
}
|
}
|
||||||
return p != 0;
|
return p != 0;
|
||||||
|
@ -600,7 +602,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
// every minute, disconnect the worst peer in hope of finding a better peer
|
// every minute, disconnect the worst peer in hope of finding a better peer
|
||||||
|
|
||||||
boost::posix_time::ptime local_time = boost::posix_time::second_clock::local_time();
|
boost::posix_time::ptime local_time = second_clock::universal_time();
|
||||||
if(m_last_optimistic_disconnect + boost::posix_time::seconds(120) <= local_time)
|
if(m_last_optimistic_disconnect + boost::posix_time::seconds(120) <= local_time)
|
||||||
{
|
{
|
||||||
m_last_optimistic_disconnect = local_time;
|
m_last_optimistic_disconnect = local_time;
|
||||||
|
@ -610,7 +612,7 @@ namespace libtorrent
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// don't do a disconnect earlier than 1 minute after some peer was connected
|
// don't do a disconnect earlier than 1 minute after some peer was connected
|
||||||
m_last_optimistic_disconnect = boost::posix_time::second_clock::local_time();
|
m_last_optimistic_disconnect = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (num_connected_peers > max_connections)
|
while (num_connected_peers > max_connections)
|
||||||
|
@ -817,8 +819,8 @@ namespace libtorrent
|
||||||
i->prev_amount_download = 0;
|
i->prev_amount_download = 0;
|
||||||
i->prev_amount_upload = 0;
|
i->prev_amount_upload = 0;
|
||||||
i->connection = &c;
|
i->connection = &c;
|
||||||
i->connected = boost::posix_time::second_clock::local_time();
|
i->connected = second_clock::universal_time();
|
||||||
m_last_optimistic_disconnect = boost::posix_time::second_clock::local_time();
|
m_last_optimistic_disconnect = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
void policy::peer_from_tracker(const address& remote, const peer_id& id)
|
void policy::peer_from_tracker(const address& remote, const peer_id& id)
|
||||||
|
@ -992,7 +994,7 @@ namespace libtorrent
|
||||||
assert(!p->connection->is_disconnecting());
|
assert(!p->connection->is_disconnecting());
|
||||||
|
|
||||||
p->connection->send_unchoke();
|
p->connection->send_unchoke();
|
||||||
p->last_optimistically_unchoked = boost::posix_time::second_clock::local_time();
|
p->last_optimistically_unchoked = second_clock::universal_time();
|
||||||
++m_num_unchoked;
|
++m_num_unchoked;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1020,7 +1022,7 @@ namespace libtorrent
|
||||||
p->prev_amount_upload = 0;
|
p->prev_amount_upload = 0;
|
||||||
p->connected =
|
p->connected =
|
||||||
m_last_optimistic_disconnect =
|
m_last_optimistic_disconnect =
|
||||||
boost::posix_time::second_clock::local_time();
|
second_clock::universal_time();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (network_error&)
|
catch (network_error&)
|
||||||
|
@ -1052,7 +1054,7 @@ namespace libtorrent
|
||||||
if (i == m_peers.end()) return;
|
if (i == m_peers.end()) return;
|
||||||
assert(i->connection == &c);
|
assert(i->connection == &c);
|
||||||
|
|
||||||
i->connected = boost::posix_time::second_clock::local_time();
|
i->connected = second_clock::universal_time();
|
||||||
if (!i->connection->is_choked() && !m_torrent->is_aborted())
|
if (!i->connection->is_choked() && !m_torrent->is_aborted())
|
||||||
{
|
{
|
||||||
// if the peer that is diconnecting is unchoked
|
// if the peer that is diconnecting is unchoked
|
||||||
|
@ -1139,7 +1141,7 @@ namespace libtorrent
|
||||||
, banned(false)
|
, banned(false)
|
||||||
, connection(0)
|
, connection(0)
|
||||||
{
|
{
|
||||||
assert(connected < boost::posix_time::second_clock::local_time());
|
assert(connected < second_clock::universal_time());
|
||||||
}
|
}
|
||||||
|
|
||||||
size_type policy::peer::total_download() const
|
size_type policy::peer::total_download() const
|
||||||
|
|
|
@ -77,6 +77,8 @@ namespace std
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
namespace libtorrent { namespace detail
|
namespace libtorrent { namespace detail
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -320,7 +322,7 @@ namespace libtorrent { namespace detail
|
||||||
std::vector<boost::shared_ptr<socket> > readable_clients;
|
std::vector<boost::shared_ptr<socket> > readable_clients;
|
||||||
std::vector<boost::shared_ptr<socket> > writable_clients;
|
std::vector<boost::shared_ptr<socket> > writable_clients;
|
||||||
std::vector<boost::shared_ptr<socket> > error_clients;
|
std::vector<boost::shared_ptr<socket> > error_clients;
|
||||||
boost::posix_time::ptime timer = boost::posix_time::second_clock::local_time();
|
boost::posix_time::ptime timer = second_clock::universal_time();
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
int loops_per_second = 0;
|
int loops_per_second = 0;
|
||||||
|
@ -597,9 +599,9 @@ namespace libtorrent { namespace detail
|
||||||
check_invariant("after ERROR SOCKETS");
|
check_invariant("after ERROR SOCKETS");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::posix_time::time_duration d = boost::posix_time::second_clock::local_time() - timer;
|
boost::posix_time::time_duration d = second_clock::universal_time() - timer;
|
||||||
if (d.seconds() < 1) continue;
|
if (d.seconds() < 1) continue;
|
||||||
timer = boost::posix_time::second_clock::local_time();
|
timer = second_clock::universal_time();
|
||||||
|
|
||||||
// ************************
|
// ************************
|
||||||
// THE SECTION BELOW IS EXECUTED ONCE EVERY SECOND
|
// THE SECTION BELOW IS EXECUTED ONCE EVERY SECOND
|
||||||
|
|
|
@ -72,6 +72,7 @@ namespace std
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
@ -157,7 +158,7 @@ namespace libtorrent
|
||||||
, m_event(tracker_request::started)
|
, m_event(tracker_request::started)
|
||||||
, m_block_size(0)
|
, m_block_size(0)
|
||||||
, m_storage(0)
|
, m_storage(0)
|
||||||
, m_next_request(boost::posix_time::second_clock::local_time())
|
, m_next_request(second_clock::universal_time())
|
||||||
, m_duration(1800)
|
, m_duration(1800)
|
||||||
, m_policy()
|
, m_policy()
|
||||||
, m_ses(ses)
|
, m_ses(ses)
|
||||||
|
@ -195,7 +196,7 @@ namespace libtorrent
|
||||||
, m_event(tracker_request::started)
|
, m_event(tracker_request::started)
|
||||||
, m_block_size(0)
|
, m_block_size(0)
|
||||||
, m_storage(0)
|
, m_storage(0)
|
||||||
, m_next_request(boost::posix_time::second_clock::local_time())
|
, m_next_request(second_clock::universal_time())
|
||||||
, m_duration(1800)
|
, m_duration(1800)
|
||||||
, m_policy()
|
, m_policy()
|
||||||
, m_ses(ses)
|
, m_ses(ses)
|
||||||
|
@ -247,14 +248,13 @@ namespace libtorrent
|
||||||
// tracker request
|
// tracker request
|
||||||
bool torrent::should_request()
|
bool torrent::should_request()
|
||||||
{
|
{
|
||||||
namespace time = boost::posix_time;
|
|
||||||
if (m_just_paused)
|
if (m_just_paused)
|
||||||
{
|
{
|
||||||
m_just_paused = false;
|
m_just_paused = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return !m_paused &&
|
return !m_paused &&
|
||||||
m_next_request < time::second_clock::local_time();
|
m_next_request < second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::tracker_response(
|
void torrent::tracker_response(
|
||||||
|
@ -268,7 +268,7 @@ namespace libtorrent
|
||||||
|
|
||||||
m_last_working_tracker
|
m_last_working_tracker
|
||||||
= prioritize_tracker(m_currently_trying_tracker);
|
= prioritize_tracker(m_currently_trying_tracker);
|
||||||
m_next_request = boost::posix_time::second_clock::local_time()
|
m_next_request = second_clock::universal_time()
|
||||||
+ boost::posix_time::seconds(m_duration);
|
+ boost::posix_time::seconds(m_duration);
|
||||||
m_currently_trying_tracker = 0;
|
m_currently_trying_tracker = 0;
|
||||||
|
|
||||||
|
@ -277,11 +277,11 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
// if the peer list is empty, we should contact the
|
// if the peer list is empty, we should contact the
|
||||||
// tracker soon again to see if there are any peers
|
// tracker soon again to see if there are any peers
|
||||||
m_next_request = boost::posix_time::second_clock::local_time() + boost::posix_time::seconds(60);
|
m_next_request = second_clock::universal_time() + boost::posix_time::seconds(60);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_next_request = boost::posix_time::second_clock::local_time() + boost::posix_time::seconds(m_duration);
|
m_next_request = second_clock::universal_time() + boost::posix_time::seconds(m_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// connect to random peers from the list
|
// connect to random peers from the list
|
||||||
|
@ -521,7 +521,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
m_duration = 1800;
|
m_duration = 1800;
|
||||||
m_next_request
|
m_next_request
|
||||||
= boost::posix_time::second_clock::local_time()
|
= second_clock::universal_time()
|
||||||
+ boost::posix_time::seconds(tracker_retry_delay_max);
|
+ boost::posix_time::seconds(tracker_retry_delay_max);
|
||||||
|
|
||||||
tracker_request req;
|
tracker_request req;
|
||||||
|
@ -698,12 +698,12 @@ namespace libtorrent
|
||||||
++m_failed_trackers;
|
++m_failed_trackers;
|
||||||
// if we've looped the tracker list, wait a bit before retrying
|
// if we've looped the tracker list, wait a bit before retrying
|
||||||
m_currently_trying_tracker = 0;
|
m_currently_trying_tracker = 0;
|
||||||
m_next_request = second_clock::local_time() + seconds(delay);
|
m_next_request = second_clock::universal_time() + seconds(delay);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// don't delay before trying the next tracker
|
// don't delay before trying the next tracker
|
||||||
m_next_request = boost::posix_time::second_clock::local_time();
|
m_next_request = second_clock::universal_time();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -944,7 +944,7 @@ namespace libtorrent
|
||||||
st.upload_payload_rate = m_stat.upload_payload_rate();
|
st.upload_payload_rate = m_stat.upload_payload_rate();
|
||||||
|
|
||||||
st.next_announce = next_announce()
|
st.next_announce = next_announce()
|
||||||
- boost::posix_time::second_clock::local_time();
|
- second_clock::universal_time();
|
||||||
if (st.next_announce.is_negative()) st.next_announce
|
if (st.next_announce.is_negative()) st.next_announce
|
||||||
= boost::posix_time::seconds(0);
|
= boost::posix_time::seconds(0);
|
||||||
st.announce_interval = boost::posix_time::seconds(m_duration);
|
st.announce_interval = boost::posix_time::seconds(m_duration);
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace libtorrent
|
||||||
, m_total_size(0)
|
, m_total_size(0)
|
||||||
, m_info_hash(info_hash)
|
, m_info_hash(info_hash)
|
||||||
, m_name()
|
, m_name()
|
||||||
, m_creation_date(second_clock::local_time())
|
, m_creation_date(second_clock::universal_time())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ namespace libtorrent
|
||||||
, m_total_size(0)
|
, m_total_size(0)
|
||||||
, m_info_hash(0)
|
, m_info_hash(0)
|
||||||
, m_name()
|
, m_name()
|
||||||
, m_creation_date(second_clock::local_time())
|
, m_creation_date(second_clock::universal_time())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,13 +363,12 @@ namespace libtorrent
|
||||||
|
|
||||||
entry info(entry::dictionary_t);
|
entry info(entry::dictionary_t);
|
||||||
|
|
||||||
info["length"] = m_total_size;
|
|
||||||
|
|
||||||
assert(!m_files.empty());
|
assert(!m_files.empty());
|
||||||
|
|
||||||
if (m_files.size() == 1)
|
if (m_files.size() == 1)
|
||||||
{
|
{
|
||||||
info["name"] = m_name;
|
info["name"] = m_name;
|
||||||
|
info["length"] = m_files.front().size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,8 @@ namespace
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -64,7 +66,7 @@ namespace libtorrent
|
||||||
, boost::weak_ptr<request_callback> c
|
, boost::weak_ptr<request_callback> c
|
||||||
, const http_settings& stn)
|
, const http_settings& stn)
|
||||||
: tracker_connection(c)
|
: tracker_connection(c)
|
||||||
, m_request_time(boost::posix_time::second_clock::local_time())
|
, m_request_time(second_clock::universal_time())
|
||||||
, m_request(req)
|
, m_request(req)
|
||||||
, m_transaction_id(0)
|
, m_transaction_id(0)
|
||||||
, m_connection_id(0)
|
, m_connection_id(0)
|
||||||
|
@ -85,7 +87,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
time_duration d = second_clock::local_time() - m_request_time;
|
time_duration d = second_clock::universal_time() - m_request_time;
|
||||||
return (m_transaction_id != 0
|
return (m_transaction_id != 0
|
||||||
&& m_connection_id != 0)
|
&& m_connection_id != 0)
|
||||||
|| d > seconds(m_settings.tracker_timeout);
|
|| d > seconds(m_settings.tracker_timeout);
|
||||||
|
@ -95,7 +97,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
using namespace boost::posix_time;
|
using namespace boost::posix_time;
|
||||||
|
|
||||||
time_duration d = second_clock::local_time() - m_request_time;
|
time_duration d = second_clock::universal_time() - m_request_time;
|
||||||
if (m_connection_id == 0
|
if (m_connection_id == 0
|
||||||
&& d > seconds(udp_connect_timeout))
|
&& d > seconds(udp_connect_timeout))
|
||||||
{
|
{
|
||||||
|
@ -185,7 +187,7 @@ namespace libtorrent
|
||||||
detail::write_uint16(m_request.listen_port, ptr);
|
detail::write_uint16(m_request.listen_port, ptr);
|
||||||
|
|
||||||
m_socket->send(buf, 94);
|
m_socket->send(buf, 94);
|
||||||
m_request_time = boost::posix_time::second_clock::local_time();
|
m_request_time = second_clock::universal_time();
|
||||||
++m_attempts;
|
++m_attempts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +207,7 @@ namespace libtorrent
|
||||||
detail::write_int32(m_transaction_id, ptr);
|
detail::write_int32(m_transaction_id, ptr);
|
||||||
|
|
||||||
m_socket->send(send_buf, 16);
|
m_socket->send(send_buf, 16);
|
||||||
m_request_time = boost::posix_time::second_clock::local_time();
|
m_request_time = second_clock::universal_time();
|
||||||
++m_attempts;
|
++m_attempts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue