From 169c5e6f1e15bb827e9685e464c97a360afe40dd Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 9 Nov 2009 17:43:14 +0000 Subject: [PATCH] oh, god... removed excessive twisting git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@517 e16421f0-f15b-0410-abcd-98678b794739 --- datagram.h | 3 ++- ext/seq_picker.cpp | 4 ++-- hashtree.cpp | 3 ++- sendrecv.cpp | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/datagram.h b/datagram.h index b364518..95dbae0 100644 --- a/datagram.h +++ b/datagram.h @@ -209,7 +209,8 @@ const char* tintstr(tint t=0); std::string sock2str (struct sockaddr_in addr); #define dprintf(...) printf(__VA_ARGS__) #define eprintf(...) fprintf(stderr,__VA_ARGS__) - +//#define dprintf(...) {} + } #endif diff --git a/ext/seq_picker.cpp b/ext/seq_picker.cpp index 5b0bc0a..17d4a94 100644 --- a/ext/seq_picker.cpp +++ b/ext/seq_picker.cpp @@ -20,7 +20,7 @@ class SeqPiecePicker : public PiecePicker { public: SeqPiecePicker (FileTransfer* file_to_pick_from) : - transfer_(file_to_pick_from), ack_hint_out_(), twist_() { + transfer_(file_to_pick_from), ack_hint_out_(), twist_(0) { ack_hint_out_.copy_range(file().ack_out(),bin64_t::ALL); } @@ -36,7 +36,7 @@ public: //dprintf("twist is %lli\n",twist_); if (!file().size()) return bin64_t(0,0); // a hack to get peak hashes; FIXME - twist_ &= (file().peak(0)) & ((1<<16)-1); + twist_ &= (file().peak(0)) & ((1<<6)-1); if (twist_) { offer.twist(twist_); ack_hint_out_.twist(twist_); diff --git a/hashtree.cpp b/hashtree.cpp index e74915b..bdb8cce 100644 --- a/hashtree.cpp +++ b/hashtree.cpp @@ -320,4 +320,5 @@ HashTree::~HashTree () { memory_unmap(hash_fd_, hashes_, sizek_*2*sizeof(Sha1Hash)); if (fd_) close(fd_); -} \ No newline at end of file +} + diff --git a/sendrecv.cpp b/sendrecv.cpp index a3ca654..1d27470 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -164,13 +164,14 @@ void Channel::AddHint (Datagram& dgram) { for(tbqueue::iterator i=hint_out_.begin(); i!=hint_out_.end(); i++) hinted += i->bin.width(); //int bps = PeerBPS(); + //double kbps = max(4,TINT_SEC / dip_avg_); double peer_cwnd = rtt_avg_ / dip_avg_; if (peer_cwnd<1) peer_cwnd = 1; dprintf("%s #%i hinted %lli peer_cwnd %lli/%lli=%f\n", tintstr(),id,hinted,rtt_avg_,dip_avg_,((float)rtt_avg_/dip_avg_)); - if ( 4*peer_cwnd > hinted ) { //hinted*1024 < peer_cwnd*4 ) { + if ( 8*peer_cwnd > hinted ) { //hinted*1024 < peer_cwnd*4 ) { uint8_t layer = 2; // actually, enough bin64_t hint = transfer().picker().Pick(ack_in_,layer); -- 2.20.1