]> p2p-next.cs.pub.ro Git - swift-upb.git/commitdiff
fixing data_out_
authorvictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Tue, 10 Nov 2009 09:05:37 +0000 (09:05 +0000)
committervictor <victor@e16421f0-f15b-0410-abcd-98678b794739>
Tue, 10 Nov 2009 09:05:37 +0000 (09:05 +0000)
git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@521 e16421f0-f15b-0410-abcd-98678b794739

ext/send_control.cpp
ext/send_control.h
hashtree.h
sendrecv.cpp

index 829bc960a9c46715fd2d7e723e5a8b32afbd424e..7fa41e3652b80cc7535bbd23c9613eb9f658b0f3 100644 (file)
@@ -98,7 +98,10 @@ void    CwndController::OnDataRecvd(bin64_t b) {
     
 void    CwndController::OnAckRcvd(bin64_t ackd) {
     if (ackd==bin64_t::NONE) {
-        cwnd_ /= 2;
+        if (NOW>last_change_+ch_->rtt_avg_) {
+            cwnd_ /= 2;
+            last_change_ = NOW;
+        }
     } else {
         if (cwnd_<1)
             cwnd_ *= 2;
index 1f31aaa9cb4d865020450e3c377d0408366d409a..3489a22e3888d6c6876610a2130772ff68dcc201 100644 (file)
@@ -80,10 +80,11 @@ struct KeepAliveController : public SendController {
 
 struct CwndController : public SendController {
     
-    double   cwnd_;
+    double  cwnd_;
+    tint    last_change_;
     
     CwndController(SendController* orig, int cwnd=1) :
-    SendController(orig), cwnd_(cwnd) {    }
+    SendController(orig), cwnd_(cwnd), last_change_(0) {    }
     
     bool    MaySendData() ;
     tint    NextSendTime () ;
index b24c75c4c56be8d0911ab86c74d8535dff988174..0f97618aeceb66e43ee71065bc809a9c67037e22 100644 (file)
@@ -93,7 +93,7 @@ public:
     uint64_t        complete_kilo () const { return completek_; }
     uint64_t        seq_complete () ;
     bool            is_complete () 
-        { return size_ && seq_complete()==size_; }
+        { return size_ && complete_==size_; }
     bins&           ack_out () { return ack_out_; }
        
        ~HashTree ();
index 7a8a5d41a4c5df881bb5ddd153a0579d8f7eb339..01d799f230d56d7e1acb533fbbcfb834b5bcde01 100644 (file)
@@ -104,6 +104,8 @@ void    Channel::ClearStaleDataOut() {
         data_out_.pop_front();
     if (data_out_.size()!=oldsize)
         cc_->OnAckRcvd(bin64_t::NONE);
+    while (data_out_.size() && ack_in_.get(data_out_.front().bin)==bins::FILLED)
+        data_out_.pop_front();
 }
 
 
@@ -143,12 +145,15 @@ void      Channel::AddHint (Datagram& dgram) {
         tintbin f = hint_out_.front();
         if (f.time<NOW-rtt_avg_*8) {
             hint_out_.pop_front();
+            transfer().picker().Expired(f.bin);
         } else {
             int status = file().ack_out().get(f.bin);
             if (status==bins::EMPTY) {
+                transfer().picker().Received(f.bin);
                 break;
             } else if (status==bins::FILLED) {
                 hint_out_.pop_front();
+                transfer().picker().Expired(f.bin);
             } else { // mixed
                 hint_out_.front().bin = f.bin.right();
                 f.bin = f.bin.left();