oh, god... removed excessive twisting
authorvictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Mon, 9 Nov 2009 17:43:14 +0000 (17:43 +0000)
committervictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Mon, 9 Nov 2009 17:43:14 +0000 (17:43 +0000)
git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@517 e16421f0-f15b-0410-abcd-98678b794739

datagram.h
ext/seq_picker.cpp
hashtree.cpp
sendrecv.cpp

index b364518..95dbae0 100644 (file)
@@ -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
index 5b0bc0a..17d4a94 100644 (file)
@@ -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_);
index e74915b..bdb8cce 100644 (file)
@@ -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
+}
+
index a3ca654..1d27470 100644 (file)
@@ -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);