From 71df12311ca17d8cb73a32ed086ca4e4a29b201e Mon Sep 17 00:00:00 2001 From: victor Date: Tue, 10 Nov 2009 15:55:08 +0000 Subject: [PATCH] unscheduled sends git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@531 e16421f0-f15b-0410-abcd-98678b794739 --- BUGS | 22 ++++++++++++---------- sendrecv.cpp | 10 +++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/BUGS b/BUGS index b86f30f..d94069d 100644 --- a/BUGS +++ b/BUGS @@ -1,19 +1,21 @@ - * hints, data for non-existing ranges + v hints, data for non-existing ranges * opens multiple channels to the same address - * hints do not expire - * RTT calculations need improvement (test) - * google-log is unnecessary + v hints do not expire + v RTT calculations need improvement (test) + v google-log is unnecessary * reduce template use (peer queue) v hints do not expire - * survive 10% loss + v survive 10% loss * unlimited ping pong - * git - * check hints agains ack_out?_ - * check data against ack_in + v git sha-1 + v check hints agains ack_out?_ + v check data against ack_in v channel suspend/wake. 3 cong modes state machine - ??? * minimize the number of template instantiations - * Channel thinks how much it HINTs a second, + v Channel thinks how much it HINTs a second, picker thinks which HINTs are snubbed * dead Channels are not killed => cannot open a new one (have a channel already) - * peers don't cooperate + v peers don't cooperate + * RecoverProgress fails sometime + * leecher can't see file is done already diff --git a/sendrecv.cpp b/sendrecv.cpp index 475187b..d2bde7c 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -59,7 +59,7 @@ bin64_t Channel::DequeueHint () { // TODO: resilience hint_in_.pop_front(); send = file().ack_out().find_filtered (ack_in_,hint,0,bins::FILLED); - dprintf("%s #%i may_send %lli\n",tintstr(),id,send.base_offset()); + dprintf("%s #%i dequeued %lli\n",tintstr(),id,send.base_offset()); if (send!=bin64_t::NONE) while (send!=hint) { hint = hint.towards(send); @@ -134,8 +134,6 @@ void Channel::Send () { cc_->OnDataSent(data); if (dgram.Send()==-1) print_error("can't send datagram"); - last_send_time_ = NOW; - RequeueSend(cc_->NextSendTime()); } @@ -286,7 +284,7 @@ void Channel::Recv (Datagram& dgram) { cc_->OnDataRecvd(data); last_recv_time_ = NOW; if (data!=bin64_t::ALL) - RequeueSend(NOW); + Send(); //RequeueSend(NOW); } @@ -332,7 +330,7 @@ void Channel::OnAck (Datagram& dgram) { dev_avg_ = ( dev_avg_*3 + abs(rtt-rtt_avg_) ) >> 2; dprintf("%s #%i rtt %lli dev %lli\n", tintstr(),id,rtt_avg_,dev_avg_); - cc_->OnAckRcvd(data_out_[i].bin); + cc_->OnAckRcvd(data_out_[i].bin); // may be invoked twice FIXME FIXME FIXME } ack_in_.set(ackd_pos); while (data_out_.size() && ack_in_.get(data_out_.front().bin)==bins::FILLED) @@ -475,6 +473,8 @@ void Channel::Loop (tint howlong) { dprintf("%s #%i sch_send %s\n",tintstr(),sender->id, tintstr(send_time)); sender->Send(); + sender->last_send_time_ = NOW; + sender->RequeueSend(sender->cc_->NextSendTime()); pop_heap(send_queue.begin(), send_queue.end(), tblater); send_queue.pop_back(); } else { -- 2.20.1