mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 14:28:22 +00:00
confirmation for local items only
This commit is contained in:
parent
785d05f10c
commit
683f55f8d2
@ -121,12 +121,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(false), next_refresh_time(0) {}
|
dht_storage_item() : p(), sig_p(), sig_user(), local_add_time(0), confirmed(true), next_refresh_time(0) {}
|
||||||
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(false), next_refresh_time(0) {}
|
local_add_time(0), confirmed(true), next_refresh_time(0) {}
|
||||||
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(false), next_refresh_time(0) {}
|
: p(_p), sig_p(_sig_p), sig_user(_sig_user), local_add_time(0), confirmed(true), next_refresh_time(0) {}
|
||||||
std::string p;
|
std::string p;
|
||||||
std::string sig_p;
|
std::string sig_p;
|
||||||
std::string sig_user;
|
std::string sig_user;
|
||||||
|
@ -474,6 +474,7 @@ void node_impl::putDataSigned(std::string const &username, std::string const &re
|
|||||||
|
|
||||||
dht_storage_item item(str_p, sig_p, sig_user);
|
dht_storage_item item(str_p, sig_p, sig_user);
|
||||||
item.local_add_time = time(NULL);
|
item.local_add_time = time(NULL);
|
||||||
|
item.confirmed = false;
|
||||||
std::vector<char> vbuf;
|
std::vector<char> vbuf;
|
||||||
bencode(std::back_inserter(vbuf), p["v"]);
|
bencode(std::back_inserter(vbuf), p["v"]);
|
||||||
std::pair<char const*, int> bufv = std::make_pair(vbuf.data(), vbuf.size());
|
std::pair<char const*, int> bufv = std::make_pair(vbuf.data(), vbuf.size());
|
||||||
@ -749,9 +750,6 @@ void node_impl::load_storage(entry const* e) {
|
|||||||
entry const *confirmed( j->find_key("confirmed") );
|
entry const *confirmed( j->find_key("confirmed") );
|
||||||
if(confirmed) {
|
if(confirmed) {
|
||||||
item.confirmed = (bool) confirmed->integer();
|
item.confirmed = (bool) confirmed->integer();
|
||||||
} else {
|
|
||||||
// compatibility with twister 0.9.22 and below
|
|
||||||
item.confirmed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// just for printf for now
|
// just for printf for now
|
||||||
|
Loading…
Reference in New Issue
Block a user