diff --git a/libtorrent/include/libtorrent/kademlia/node.hpp b/libtorrent/include/libtorrent/kademlia/node.hpp index 0e1fe468..3afeaf59 100644 --- a/libtorrent/include/libtorrent/kademlia/node.hpp +++ b/libtorrent/include/libtorrent/kademlia/node.hpp @@ -118,12 +118,12 @@ struct torrent_entry struct dht_storage_item { // 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) : 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) - : 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 sig_p; std::string sig_user; diff --git a/libtorrent/include/libtorrent/ptime.hpp b/libtorrent/include/libtorrent/ptime.hpp index bf4016d3..e5cf55ac 100644 --- a/libtorrent/include/libtorrent/ptime.hpp +++ b/libtorrent/include/libtorrent/ptime.hpp @@ -83,7 +83,7 @@ namespace libtorrent struct TORRENT_EXPORT ptime { // hidden - ptime() {} + ptime() {time = 0;} explicit ptime(boost::uint64_t t): time(t) {} // these operators have the same semantics as signed 64 bit integers diff --git a/libtorrent/src/kademlia/node.cpp b/libtorrent/src/kademlia/node.cpp index b9371adc..cc53f6b1 100644 --- a/libtorrent/src/kademlia/node.cpp +++ b/libtorrent/src/kademlia/node.cpp @@ -338,7 +338,7 @@ namespace 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] + milliseconds(500), // add +/-10% diffusion to next refresh time @@ -813,7 +813,7 @@ void node_impl::load_storage(entry const* e) { return; 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());