std::string sock2str (struct sockaddr_in addr);
#define dprintf(...) printf(__VA_ARGS__)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
-
+//#define dprintf(...) {}
+
}
#endif
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);
}
//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_);
memory_unmap(hash_fd_, hashes_, sizek_*2*sizeof(Sha1Hash));
if (fd_)
close(fd_);
-}
\ No newline at end of file
+}
+
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);