From edc6b6824cd237ef83ddeed6180e8d048af62bd7 Mon Sep 17 00:00:00 2001 From: victor Date: Sun, 15 Nov 2009 08:01:20 +0000 Subject: [PATCH] fast_fix git-svn-id: https://ttuki.vtt.fi/svn/p2p-next/TUD/p2tp/trunk@558 e16421f0-f15b-0410-abcd-98678b794739 --- p2tp.cpp | 3 ++- p2tp.h | 1 + sendrecv.cpp | 18 ++++++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/p2tp.cpp b/p2tp.cpp index 2db3de2..491e04c 100644 --- a/p2tp.cpp +++ b/p2tp.cpp @@ -42,7 +42,8 @@ Channel::Channel (FileTransfer* transfer, int socket, Address peer_addr) : socket_(socket==-1?sockets[0]:socket), // FIXME data_out_cap_(bin64_t::ALL), last_send_data_time_(0), last_recv_data_time_(0), own_id_mentioned_(false), next_send_time_(0), last_send_time_(0), - last_recv_time_(0), rtt_avg_(TINT_SEC), dev_avg_(0), dip_avg_(TINT_SEC) + last_recv_time_(0), rtt_avg_(TINT_SEC), dev_avg_(0), dip_avg_(TINT_SEC), + data_in_dbl_(bin64_t::NONE) { if (peer_==Address()) peer_ = tracker; diff --git a/p2tp.h b/p2tp.h index 4681a56..5a1a715 100644 --- a/p2tp.h +++ b/p2tp.h @@ -272,6 +272,7 @@ namespace p2tp { bins ack_in_; /** Last data received; needs to be acked immediately. */ tintbin data_in_; + bin64_t data_in_dbl_; /** The history of data sent and still unacknowledged. */ tbqueue data_out_; bin64_t data_out_cap_; diff --git a/sendrecv.cpp b/sendrecv.cpp index 5bd424c..c38634f 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -61,13 +61,16 @@ bin64_t Channel::DequeueHint () { // TODO: resilience continue; send = file().ack_out().find_filtered(ack_in_,hint,bins::FILLED); send = send.left_foot(); // single packet - dprintf("%s #%i dequeued %lli\n",tintstr(),id,send.base_offset()); if (send!=bin64_t::NONE) while (send!=hint) { hint = hint.towards(send); hint_in_.push_front(hint.sibling()); } } + uint64_t mass = 0; + for(int i=0; i2) + data_in_dbl_ = pos; } for(int count=0; count<4; count++) { bin64_t ack = file().ack_out().find_filtered(ack_out_, bin64_t::ALL, bins::FILLED); @@ -314,7 +324,7 @@ bin64_t Channel::OnData (Datagram& dgram) { uint8_t *data; int length = dgram.Pull(&data,1024); bool ok = (pos==bin64_t::NONE) || file().OfferData(pos, (char*)data, length) ; - dprintf("%s #%i %cdata (%lli)\n",tintstr(),id,ok?'-':'!',pos.offset()); + dprintf("%s #%i %cdata %s\n",tintstr(),id,ok?'-':'!',pos.str()); if (!ok) return bin64_t::NONE; data_in_ = tintbin(NOW,pos); -- 2.20.1