OK, now we have long-fat-pipe syndrome
authorvictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Tue, 10 Nov 2009 15:04:31 +0000 (15:04 +0000)
committervictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Tue, 10 Nov 2009 15:04:31 +0000 (15:04 +0000)
git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@530 e16421f0-f15b-0410-abcd-98678b794739

ext/send_control.cpp
sendrecv.cpp
sha1.h

index 7fa41e3..fc72fd9 100644 (file)
@@ -71,7 +71,7 @@ void    KeepAliveController::OnAckRcvd(bin64_t ackd) {
 
 
 bool    CwndController::MaySendData() {
-    dprintf("%s #%i maysend %i < %f & %s (rtt %lli)\n",tintstr(),
+    dprintf("%s #%i sendctrl may send %i < %f & %s (rtt %lli)\n",tintstr(),
             ch_->id,(int)ch_->data_out_.size(),cwnd_,tintstr(NextSendTime()),
             ch_->rtt_avg_);
     return ch_->data_out_.size() < cwnd_  &&  NOW >= NextSendTime();
@@ -98,6 +98,7 @@ void    CwndController::OnDataRecvd(bin64_t b) {
     
 void    CwndController::OnAckRcvd(bin64_t ackd) {
     if (ackd==bin64_t::NONE) {
+        dprintf("%s #%i sendctrl loss detected\n",tintstr(),ch_->id);
         if (NOW>last_change_+ch_->rtt_avg_) {
             cwnd_ /= 2;
             last_change_ = NOW;
@@ -106,7 +107,8 @@ void    CwndController::OnAckRcvd(bin64_t ackd) {
         if (cwnd_<1)
             cwnd_ *= 2;
         else 
-            cwnd_ += 1/cwnd_;
+            cwnd_ += 1.0/cwnd_;
+        dprintf("%s #%i sendctrl cwnd to %f\n",tintstr(),ch_->id,cwnd_);
     }
 }
 
@@ -122,9 +124,15 @@ void SlowStartController::OnAckRcvd (bin64_t pos) {
     
 
 void AIMDController::OnAckRcvd (bin64_t pos) {
-    if (pos!=bin64_t::NONE)
+    if (pos==bin64_t::NONE) {
+        dprintf("%s #%i sendctrl loss detected\n",tintstr(),ch_->id);
+        if (NOW>last_change_+ch_->rtt_avg_) {
+            cwnd_ /= 2;
+            last_change_ = NOW;
+        }
+    } else {
         cwnd_ += 1.0/cwnd_;
-    else 
-        cwnd_ /= 2;
+        dprintf("%s #%i sendctrl cwnd to %f\n",tintstr(),ch_->id,cwnd_);
+    }
 }
  
index 8545074..475187b 100644 (file)
@@ -132,7 +132,7 @@ void        Channel::Send () {
     if (dgram.size()==4) // only the channel id; bare keep-alive
         data = bin64_t::ALL;
     cc_->OnDataSent(data);
-       if (dgram.Send()==-1)
+    if (dgram.Send()==-1)
         print_error("can't send datagram");
     last_send_time_ = NOW;
     RequeueSend(cc_->NextSendTime());
@@ -202,7 +202,7 @@ bin64_t             Channel::AddData (Datagram& dgram) {
                return bin64_t::NONE;
        bin64_t tosend = DequeueHint();
     if (tosend==bin64_t::NONE) {
-        dprintf("%s #%i out of hints\n",tintstr(),id);
+        dprintf("%s #%i out of hints #sendctrl\n",tintstr(),id);
         return bin64_t::NONE;
     }
     if (ack_in_.is_empty() && file().size())
@@ -221,7 +221,7 @@ bin64_t             Channel::AddData (Datagram& dgram) {
     dgram.Push(buf,r);
     dprintf("%s #%i +data (%lli)\n",tintstr(),id,tosend.base_offset());
     data_out_.push_back(tosend);
-    ack_in_.set(tosend);
+    // FIXME BUG this makes data_out_ all stale  ack_in_.set(tosend);
        return tosend;
 }
 
diff --git a/sha1.h b/sha1.h
index dc75acc..5fc8c98 100644 (file)
--- a/sha1.h
+++ b/sha1.h
@@ -18,4 +18,5 @@ void blk_SHA1_Init(blk_SHA_CTX *ctx);
 void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *dataIn, unsigned long len);
 void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
 
-#endif
\ No newline at end of file
+#endif
+