|
|
@ -1290,9 +1290,10 @@ void node_impl::incoming_request(msg const& m, entry& e) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
dht_storage_list_t & lsto = i->second; |
|
|
|
dht_storage_list_t & lsto = i->second; |
|
|
|
|
|
|
|
|
|
|
|
int j; |
|
|
|
dht_storage_list_t::reverse_iterator j, rend(lsto.rend()); |
|
|
|
for( j = 0; j < lsto.size(); j++) { |
|
|
|
dht_storage_list_t::iterator insert_pos = lsto.end(); |
|
|
|
dht_storage_item &olditem = lsto[j]; |
|
|
|
for( j = lsto.rbegin(); j != rend; ++j) { |
|
|
|
|
|
|
|
dht_storage_item &olditem = *j; |
|
|
|
|
|
|
|
|
|
|
|
lazy_entry p; |
|
|
|
lazy_entry p; |
|
|
|
int pos; |
|
|
|
int pos; |
|
|
@ -1312,16 +1313,27 @@ void node_impl::incoming_request(msg const& m, entry& e) |
|
|
|
|
|
|
|
|
|
|
|
// compare contents before adding to the list
|
|
|
|
// compare contents before adding to the list
|
|
|
|
std::pair<char const*, int> bufoldv = p.dict_find("v")->data_section(); |
|
|
|
std::pair<char const*, int> bufoldv = p.dict_find("v")->data_section(); |
|
|
|
if( bufv.second == bufoldv.second && |
|
|
|
if( bufv.second == bufoldv.second && !memcmp(bufv.first, bufoldv.first,bufv.second) ) { |
|
|
|
!memcmp(bufv.first, bufoldv.first,bufv.second)) { |
|
|
|
// break so it wont be inserted
|
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if new entry is newer than existing one, it will be inserted before
|
|
|
|
|
|
|
|
if( msg_keys[mk_height]->int_value() >= p.dict_find_int_value("height") ) { |
|
|
|
|
|
|
|
insert_pos = j.base(); |
|
|
|
|
|
|
|
insert_pos--; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(multi && j == lsto.size()) { |
|
|
|
if(multi && j == rend) { |
|
|
|
// new entry
|
|
|
|
// new entry
|
|
|
|
lsto.push_back(item); |
|
|
|
lsto.insert(insert_pos, item); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(lsto.size() > m_settings.max_entries_per_multi) { |
|
|
|
|
|
|
|
lsto.resize(m_settings.max_entries_per_multi); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if (strcmp(query, "getData") == 0) |
|
|
|
else if (strcmp(query, "getData") == 0) |
|
|
|