From 12821714607a52df56da74e2cf3b6e505f005265 Mon Sep 17 00:00:00 2001 From: Riccardo Petrocco Date: Wed, 28 May 2014 19:45:23 +0200 Subject: [PATCH] stash! fixes before merge --- SConstruct | 4 ++-- TODO | 5 +++-- cmdgw.cpp | 9 ++++----- ext/seq_picker.cpp | 6 ++---- send_control.cpp | 8 ++------ sendrecv.cpp | 6 +++--- storage.cpp | 3 +-- 7 files changed, 17 insertions(+), 24 deletions(-) diff --git a/SConstruct b/SConstruct index aef17638..5a24df6e 100644 --- a/SConstruct +++ b/SConstruct @@ -165,6 +165,6 @@ Export("libs") Export("linkflags") Export("DEBUG") Export("CODECOVERAGE") -# Arno: uncomment to build tests -SConscript('tests/SConscript') +# Uncomment the following line to build the tests +#SConscript('tests/SConscript') diff --git a/TODO b/TODO index 66e7ece8..271751d7 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,15 @@ NEW FIXES: * RTT calculation with network burst * RTT sender >= owd +* multiple samples for ledbat calculations +* flow control +* state machine changes OUTDATED: STATE MACHINE -* imposed HINTs are terribly broken, resent for the data in flight * check ACK/HAVE redundancy * HAVE overuses find_filtered -* set priorities on ranges * small-progress update problem (aka peer nap) guarantee size of updates < x% of data, on both ends * pex is affected by peer nap diff --git a/cmdgw.cpp b/cmdgw.cpp index 226bd9fc..9f3761e1 100644 --- a/cmdgw.cpp +++ b/cmdgw.cpp @@ -69,9 +69,9 @@ struct evbuffer *cmd_evbuffer = NULL; // Data received on cmd socket : WARNING: /* * SOCKTUNNEL * We added the ability for a process to tunnel data over swift's UDP socket. - * The process should send TUNNELSEND commands over the CMD TCP socket and will - * receive TUNNELRECV commands from swift, containing data received via UDP - * on channel 0xffffffff. + * The process should send TUNNELSUSCRIBE (with a chosen prefix) and TUNNELSEND + * commands over the CMD * TCP socket. It will than receive TUNNELRECV commands + * from swift. */ typedef enum { CMDGW_TUNNEL_SCAN4CRLF, @@ -736,7 +736,6 @@ int CmdGwHandleCommand(evutil_socket_t cmdsock, char *copyline) //fprintf(stderr,"cmd: START: new request %i\n",cmd_gw_reqs_count+1); // Format: START url destdir [metadir]\r\n - // Arno, 2012-04-13: See if URL followed by storagepath, and metadir for seeding std::string pstr = paramstr; std::string url="",storagepath="", metadir=""; int sidx = pstr.find(" "); @@ -1179,7 +1178,7 @@ bool InstallCmdGateway (struct event_base *evbase,Address cmdaddr,Address httpad // SOCKTUNNEL bool swift::CmdGwTunnelCheckChannel(uint32_t channel) { - // returns true is the channel is used for tunneling messages through channels + // returns true is the channel/prefix is used for tunneling messages through channels for (std::vector::iterator it = tunnel_channels_.begin(); it != tunnel_channels_.end(); ++it) if (*it == channel) return true; diff --git a/ext/seq_picker.cpp b/ext/seq_picker.cpp index 49c2396f..0d55a3af 100644 --- a/ext/seq_picker.cpp +++ b/ext/seq_picker.cpp @@ -55,11 +55,9 @@ class SeqPiecePicker : public PiecePicker { // return bin64_t(0,(hashtree()->size()>>10)-1); // dirty } retry: // bite me - // Ric: test.. just linear - //twist_ &= (hashtree()->peak(0).toUInt()) & ((1<<6)-1); + twist_ &= (hashtree()->peak(0).toUInt()) & ((1<<6)-1); - //bin_t hint = binmap_t::find_complement(ack_hint_out_, offer, twist_); - bin_t hint = binmap_t::find_complement(ack_hint_out_, offer, 0); + bin_t hint = binmap_t::find_complement(ack_hint_out_, offer, twist_); if (hint.is_none()) { return hint; // TODO: end-game mode diff --git a/send_control.cpp b/send_control.cpp index e107f794..42205461 100644 --- a/send_control.cpp +++ b/send_control.cpp @@ -94,14 +94,9 @@ tint Channel::KeepAliveNextSendTime () { mode, the next packet will be pushed further and further into the future, which is not what we want. The scheduled time for the next packet should be unchanged on reception." - ---------------- - Ric: check if we still needed. Now I perform the check for previously scheduled - events in reschedule(). Commented */ if (!reverse_pex_out_.empty()) return reverse_pex_out_.front().time; - //if (NOW < next_send_time_) - // return next_send_time_; // Arno: Fix that doesn't do exponential growth always, only after sends // without following recvs @@ -276,7 +271,8 @@ tint Channel::LedbatNextSendTime () { } /*Arno, 2012-02-02: Somehow LEDBAT gets stuck at cwnd_ == 1 sometimes - // This hack appears to work to get it back on the right track quickly. + This hack appears to work to get it back on the right track quickly. + * Ric: not really needed.. it should not happen at all! if (oldcwnd == 1 && cwnd_ == 1) cwnd_count1_++; else diff --git a/sendrecv.cpp b/sendrecv.cpp index 53a1c461..40e1fbab 100644 --- a/sendrecv.cpp +++ b/sendrecv.cpp @@ -205,11 +205,11 @@ void Channel::AddLiveSignedMunroHash(struct evbuffer *evb, bin_t munro) void Channel::AddFileUncleHashes (struct evbuffer *evb, bin_t pos) { bin_t peak = hashtree()->peak_for(pos); binvector bv; - //while (pos!=peak && ((NOW&3)==3 || !pos.parent().contains(data_out_cap_)) && - // ack_in_.is_empty(pos.parent()) ) { + while (pos!=peak && ((NOW&3)==3 || !pos.parent().contains(data_out_cap_)) && + ack_in_.is_empty(pos.parent()) ) { // Ric: TODO optimise.. send based on pkt loss statistics // the above is correct but should not happen at the beginning! - while (pos!=peak && ack_in_.is_empty(pos.parent()) ) { + //while (pos!=peak && ack_in_.is_empty(pos.parent()) ) { bin_t uncle = pos.sibling(); bv.push_back(uncle); pos = pos.parent(); diff --git a/storage.cpp b/storage.cpp index e17a426c..d99278b5 100644 --- a/storage.cpp +++ b/storage.cpp @@ -56,7 +56,6 @@ Storage::Storage(std::string ospathname, std::string destdir, int td, uint64_t l return; } } - dprintf("\n\naooo\n%s\n", filename.c_str()); // File exists. Check first bytes to see if a multifile-spec FILE *fp = fopen_utf8(filename.c_str(),"rb"); @@ -76,7 +75,7 @@ Storage::Storage(std::string ospathname, std::string destdir, int td, uint64_t l SetBroken(); return; } - dprintf("\n\naooo\n%s\n", filename.c_str()); + if (!strncmp(readbuf,MULTIFILE_PATHNAME.c_str(),MULTIFILE_PATHNAME.length())) { // Pathname points to a multi-file spec, assume we're seeding