From 0484b9b6d2b90abcfef727b0ec2a49d65a930f76 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 4 Aug 2013 16:23:55 -0300 Subject: [PATCH] implement single put seq increasing verification. untested as well. --- libtorrent/src/kademlia/node.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libtorrent/src/kademlia/node.cpp b/libtorrent/src/kademlia/node.cpp index 3042bf03..ce5d006e 100644 --- a/libtorrent/src/kademlia/node.cpp +++ b/libtorrent/src/kademlia/node.cpp @@ -1144,10 +1144,12 @@ void node_impl::incoming_request(msg const& m, entry& e) // if not multi, seq must increase if(!multi) { - dht_storage_item &item = lsto[0]; - // FIXME: Implement - // if( msg_keys[mk_seq]->int_value() > lsto[0].p.seq ) etc - if( msg_keys[mk_seq]->int_value() ) { + dht_storage_item &item = lsto[0]; + lazy_entry p; + int pos; + error_code err; + int ret = lazy_bdecode(item.p.data(), item.p.data() + item.p.size(), p, err, &pos, 10, 500); + if( msg_keys[mk_seq]->int_value() > p.dict_find_int("seq")->int_value() ) { item.p = str_p; item.sig_p = msg_keys[mk_sig_p]->string_value(); item.sig_user = msg_keys[mk_sig_user]->string_value();