From 280eeb8f78c62d8903be3f8a74814bd6e9be57ce Mon Sep 17 00:00:00 2001 From: victor Date: Sat, 7 Nov 2009 12:51:45 +0000 Subject: [PATCH] twisted picker git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@510 e16421f0-f15b-0410-abcd-98678b794739 --- exec/leecher.cpp | 2 +- ext/seq_picker.cpp | 3 +-- transfer.cpp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/exec/leecher.cpp b/exec/leecher.cpp index 8734d61..cee17e4 100644 --- a/exec/leecher.cpp +++ b/exec/leecher.cpp @@ -15,7 +15,7 @@ using namespace p2tp; /** P2TP downloader. Params: root hash, filename, tracker ip/port, own ip/port */ int main (int argn, char** args) { - srand(Datagram::Time()); + srand(time(NULL)); FileTransfer::instance = rand(); if (argn<4) { diff --git a/ext/seq_picker.cpp b/ext/seq_picker.cpp index c9b4da2..e4a624b 100644 --- a/ext/seq_picker.cpp +++ b/ext/seq_picker.cpp @@ -29,6 +29,7 @@ public: } virtual bin64_t Pick (bins& offer, uint8_t layer) { + //dprintf("twist is %lli\n",twist_); if (twist_) { offer.twist(twist_); ack_hint_out_.twist(twist_); @@ -37,8 +38,6 @@ public: (ack_hint_out_,bin64_t::ALL,layer,bins::FILLED); if (twist_) { hint = hint.twisted(twist_); - //dprintf("found twisted by %lli fixed to (%i,%lli)\n", - // twist_,hint.layer(),hint.offset()); offer.twist(0); ack_hint_out_.twist(0); } diff --git a/transfer.cpp b/transfer.cpp index 4e45484..4ae31b8 100644 --- a/transfer.cpp +++ b/transfer.cpp @@ -44,7 +44,6 @@ FileTransfer::FileTransfer (const char* filename, const Sha1Hash& _root_hash) : else RecoverProgress(); picker_ = new SeqPiecePicker(this); - picker_->Randomize(Datagram::Time()&7); } @@ -145,6 +144,7 @@ void FileTransfer::SetSize (size_t bytes) { // peaks/root must be already set } for(int i=0; iRandomize(rand()&31&(sizek_-1)); } -- 2.20.1