From: Victor Grishchenko Date: Thu, 17 Dec 2009 16:07:45 +0000 (+0100) Subject: Finally, integrated LEDBAT X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=5d9c9b3eb410fd2ce7b509c15799c6a37bef1555;p=swift-upb.git Finally, integrated LEDBAT Now, LEDBAT works in AIMD mode. Much nicer thing for long-fat networks. CUBIC is still TODO. --- diff --git a/BUGS b/BUGS index 28b97ba..d17adfb 100644 --- a/BUGS +++ b/BUGS @@ -49,3 +49,8 @@ * empty datagram hammering (see at linode) * make a testkit!!! * never back from keepalive syndrome (because of underhashing) + * HTTP daemon, combined select() loop + * range requests, priorities + * LEDBAT + * CUBIC + v misterious mass packet losses (!data) diff --git a/exec/trial.cpp b/exec/trial.cpp index 9d0b75c..10d7728 100644 --- a/exec/trial.cpp +++ b/exec/trial.cpp @@ -44,7 +44,7 @@ int main (int argn, char** args) { p2tp::SetTracker(tracker); int file = p2tp::Open(filename,root_hash); printf("Downloading %s\n",root_hash.hex().c_str()); - int count = 200; + int count = 400; while (!p2tp::IsComplete(file) && count-->0) { p2tp::Loop(TINT_SEC/10); if (count==100) diff --git a/p2tp.h b/p2tp.h index 3d7f88c..8882aca 100644 --- a/p2tp.h +++ b/p2tp.h @@ -252,7 +252,7 @@ namespace p2tp { void AddPeakHashes (Datagram& dgram); void AddPex (Datagram& dgram); - void BackOffOnLosses (); + void BackOffOnLosses (float ratio=0.5); tint SwitchSendControl (int control_mode); tint NextSendTime (); tint KeepAliveNextSendTime (); diff --git a/send_control.cpp b/send_control.cpp index d6d553b..a14d65f 100644 --- a/send_control.cpp +++ b/send_control.cpp @@ -39,10 +39,12 @@ tint Channel::SwitchSendControl (int control_mode) { case KEEP_ALIVE_CONTROL: send_interval_ = max(TINT_SEC/10,rtt_avg_); dev_avg_ = max(TINT_SEC,rtt_avg_); + data_out_cap_ = bin64_t::ALL; cwnd_ = 1; break; case PING_PONG_CONTROL: dev_avg_ = max(TINT_SEC,rtt_avg_); + data_out_cap_ = bin64_t::ALL; cwnd_ = 1; break; case SLOW_START_CONTROL: @@ -103,11 +105,11 @@ tint Channel::CwndRateNextSendTime () { } } -void Channel::BackOffOnLosses () { +void Channel::BackOffOnLosses (float ratio) { ack_rcvd_recent_ = 0; ack_not_rcvd_recent_ = 0; if (last_loss_time_ %3.2f\n", + tintstr(),id,owd_cur,owd_min,cwnd_); return CwndRateNextSendTime(); } diff --git a/sendrecv.cpp b/sendrecv.cpp index 6e31e4a..434d848 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -33,8 +33,8 @@ void Channel::AddPeakHashes (Datagram& dgram) { void Channel::AddUncleHashes (Datagram& dgram, bin64_t pos) { bin64_t peak = file().peak_for(pos); - while (pos!=peak && /*((NOW&3)==3 || !data_out_cap_.within(pos.parent())) &&*/ - ack_in_.get(pos.parent())==bins::EMPTY) { + while (pos!=peak && ((NOW&3)==3 || !data_out_cap_.within(pos.parent())) && + ack_in_.get(pos.parent())==bins::EMPTY ) { bin64_t uncle = pos.sibling(); dgram.Push8(P2TP_HASH); dgram.Push32((uint32_t)uncle); @@ -125,12 +125,12 @@ void Channel::Send () { data = bin64_t::ALL; //dprintf("%s #%u considering keepalive %i %f %s\n", // tintstr(),id,(int)data_out_.size(),cwnd_,SEND_CONTROL_MODES[send_control_]); - if (data_out_.size()> 3; dev_avg_ = ( dev_avg_*3 + abs(rtt-rtt_avg_) ) >> 2; + if (peer_send_time_) { + tint owd = peer_send_time_ - data_out_[i].time; + owd_cur_bin_ = (owd_cur_bin_+1) & 3; + owd_current_[owd_cur_bin_] = owd; + if (owd_min_bin_start_owd) + owd_min_bins_[owd_min_bin_] = owd; + } dprintf("%s #%u rtt %lli dev %lli\n",tintstr(),id,rtt_avg_,dev_avg_); bin64_t pos = data_out_[i].bin; ack_rcvd_recent_++;