From 74885f2909ea237a050d27ec3d5eb639cac1148e Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 10 Nov 2009 09:05:37 +0000 Subject: [PATCH] fixing data_out_ git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@521 e16421f0-f15b-0410-abcd-98678b794739 --- ext/send_control.cpp | 5 ++++- ext/send_control.h | 5 +++-- hashtree.h | 2 +- sendrecv.cpp | 5 +++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ext/send_control.cpp b/ext/send_control.cpp index 829bc96..7fa41e3 100644 --- a/ext/send_control.cpp +++ b/ext/send_control.cpp @@ -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; diff --git a/ext/send_control.h b/ext/send_control.h index 1f31aaa..3489a22 100644 --- a/ext/send_control.h +++ b/ext/send_control.h @@ -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 () ; diff --git a/hashtree.h b/hashtree.h index b24c75c..0f97618 100644 --- a/hashtree.h +++ b/hashtree.h @@ -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 (); diff --git a/sendrecv.cpp b/sendrecv.cpp index 7a8a5d4..01d799f 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -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