Browse Source

fix compilation for android which uses boost::posix_time::ptime (TORRENT_USE_BOOST_DATE_TIME)

miguelfreitas
Miguel Freitas 10 years ago
parent
commit
7bc233c1a7
  1. 6
      libtorrent/include/libtorrent/kademlia/node.hpp
  2. 2
      libtorrent/include/libtorrent/ptime.hpp
  3. 4
      libtorrent/src/kademlia/node.cpp

6
libtorrent/include/libtorrent/kademlia/node.hpp

@ -118,12 +118,12 @@ struct torrent_entry
struct dht_storage_item struct dht_storage_item
{ {
// FIXME: optimize so bdecode is not needed all the time // FIXME: optimize so bdecode is not needed all the time
dht_storage_item() : p(), sig_p(), sig_user(), local_add_time(0), confirmed(true), next_refresh_time(0) {} dht_storage_item() : p(), sig_p(), sig_user(), local_add_time(0), confirmed(true), next_refresh_time() {}
dht_storage_item(std::string const &_p, lazy_entry const *_sig_p, lazy_entry const *_sig_user) dht_storage_item(std::string const &_p, lazy_entry const *_sig_p, lazy_entry const *_sig_user)
: p(_p), sig_p(_sig_p->string_value()), sig_user(_sig_user->string_value()), : p(_p), sig_p(_sig_p->string_value()), sig_user(_sig_user->string_value()),
local_add_time(0), confirmed(true), next_refresh_time(0) {} local_add_time(0), confirmed(true), next_refresh_time() {}
dht_storage_item(std::string const &_p, std::string const &_sig_p, std::string const &_sig_user) dht_storage_item(std::string const &_p, std::string const &_sig_p, std::string const &_sig_user)
: p(_p), sig_p(_sig_p), sig_user(_sig_user), local_add_time(0), confirmed(true), next_refresh_time(0) {} : p(_p), sig_p(_sig_p), sig_user(_sig_user), local_add_time(0), confirmed(true), next_refresh_time() {}
std::string p; std::string p;
std::string sig_p; std::string sig_p;
std::string sig_user; std::string sig_user;

2
libtorrent/include/libtorrent/ptime.hpp

@ -83,7 +83,7 @@ namespace libtorrent
struct TORRENT_EXPORT ptime struct TORRENT_EXPORT ptime
{ {
// hidden // hidden
ptime() {} ptime() {time = 0;}
explicit ptime(boost::uint64_t t): time(t) {} explicit ptime(boost::uint64_t t): time(t) {}
// these operators have the same semantics as signed 64 bit integers // these operators have the same semantics as signed 64 bit integers

4
libtorrent/src/kademlia/node.cpp

@ -338,7 +338,7 @@ namespace
ptime getNextRefreshTime(bool confirmed = true) ptime getNextRefreshTime(bool confirmed = true)
{ {
static ptime nextRefreshTime[2] = { ptime(0), ptime(0) }; static ptime nextRefreshTime[2] = { ptime(), ptime() };
nextRefreshTime[confirmed] = std::max( nextRefreshTime[confirmed] = std::max(
nextRefreshTime[confirmed] + milliseconds(500), nextRefreshTime[confirmed] + milliseconds(500),
// add +/-10% diffusion to next refresh time // add +/-10% diffusion to next refresh time
@ -813,7 +813,7 @@ void node_impl::load_storage(entry const* e) {
return; return;
ptime const now = time_now(); ptime const now = time_now();
time_duration const refresh_interval = std::max( DHT_REFRESH_CONFIRMED, e->dict().size() * milliseconds(500) ); time_duration const refresh_interval = std::max( DHT_REFRESH_CONFIRMED, milliseconds(e->dict().size() * 500) );
printf("node dht: loading storage... (%lu node_id keys)\n", e->dict().size()); printf("node dht: loading storage... (%lu node_id keys)\n", e->dict().size());

Loading…
Cancel
Save