Browse Source

refresh mention resource in dht

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
25128d93dd
  1. 2
      libtorrent/include/libtorrent/kademlia/node.hpp
  2. 2
      libtorrent/include/libtorrent/session_settings.hpp
  3. 25
      libtorrent/src/kademlia/node.cpp
  4. 2
      src/clientversion.h

2
libtorrent/include/libtorrent/kademlia/node.hpp

@ -295,7 +295,7 @@ private:
ptime m_last_tracker_tick; ptime m_last_tracker_tick;
ptime m_next_storage_refresh; ptime m_next_storage_refresh;
node_id m_last_refreshed_item; std::pair<node_id, int> m_last_refreshed_item;
// secret random numbers used to create write tokens // secret random numbers used to create write tokens
int m_secret[2]; int m_secret[2];

2
libtorrent/include/libtorrent/session_settings.hpp

@ -990,7 +990,7 @@ namespace libtorrent
, max_fail_count(20) , max_fail_count(20)
, max_torrents(2000) , max_torrents(2000)
, max_dht_items(700) , max_dht_items(700)
, max_entries_per_multi(50) , max_entries_per_multi(32)
, max_torrent_search_reply(20) , max_torrent_search_reply(20)
, restrict_routing_ips(true) , restrict_routing_ips(true)
, restrict_search_ips(true) , restrict_search_ips(true)

25
libtorrent/src/kademlia/node.cpp

@ -497,15 +497,16 @@ bool node_impl::refresh_storage() {
for (dht_storage_table_t::const_iterator i = m_storage_table.begin(), for (dht_storage_table_t::const_iterator i = m_storage_table.begin(),
end(m_storage_table.end()); i != end; ++i ) end(m_storage_table.end()); i != end; ++i )
{ {
if( i->first == m_last_refreshed_item ) {
refresh_next_item = true;
num_refreshable++;
continue;
}
dht_storage_list_t const& lsto = i->second; dht_storage_list_t const& lsto = i->second;
if( lsto.size() == 1 ) { dht_storage_list_t::const_iterator j(lsto.begin()), jEnd(lsto.end());
dht_storage_item const& item = lsto.front(); for(int jIdx = 0; j != jEnd; ++j, ++jIdx ) {
dht_storage_item const& item = *j;
if( std::make_pair(i->first,jIdx) == m_last_refreshed_item ) {
refresh_next_item = true;
num_refreshable++;
continue;
}
#ifdef ENABLE_DHT_ITEM_EXPIRE #ifdef ENABLE_DHT_ITEM_EXPIRE
if( has_expired(item) ) { if( has_expired(item) ) {
@ -524,13 +525,13 @@ bool node_impl::refresh_storage() {
std::string resource = target->dict_find_string_value("r"); std::string resource = target->dict_find_string_value("r");
bool multi = (target->dict_find_string_value("t") == "m"); bool multi = (target->dict_find_string_value("t") == "m");
// refresh only signed single posts // refresh only signed single posts and mentions
if( !multi ) { if( !multi || (multi && resource == "mention") ) {
num_refreshable++; num_refreshable++;
if( refresh_next_item ) { if( refresh_next_item ) {
refresh_next_item = false; refresh_next_item = false;
m_last_refreshed_item = i->first; m_last_refreshed_item = std::make_pair(i->first,jIdx);
#ifdef TORRENT_DHT_VERBOSE_LOGGING #ifdef TORRENT_DHT_VERBOSE_LOGGING
printf("node dht: refreshing storage: [%s,%s,%s]\n", printf("node dht: refreshing storage: [%s,%s,%s]\n",
username.c_str(), username.c_str(),
@ -555,7 +556,7 @@ bool node_impl::refresh_storage() {
} }
if( !did_something && m_storage_table.size() ) { if( !did_something && m_storage_table.size() ) {
m_last_refreshed_item = m_storage_table.begin()->first; m_last_refreshed_item = std::make_pair(m_storage_table.begin()->first,0);
} }
time_duration sleepToRefresh; time_duration sleepToRefresh;

2
src/clientversion.h

@ -8,7 +8,7 @@
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it // These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 9 #define CLIENT_VERSION_MINOR 9
#define CLIENT_VERSION_REVISION 04 #define CLIENT_VERSION_REVISION 05
#define CLIENT_VERSION_BUILD 0 #define CLIENT_VERSION_BUILD 0
// Set to true for release, false for prerelease or test build // Set to true for release, false for prerelease or test build

Loading…
Cancel
Save