* hints, data for non-existing ranges
* opens multiple channels to the same address
- * hints do not expire
+ v hints do not expire
+ * survive 10% loss
+ * unlimited ping pong
+ * git
+ * check hints agains ack_out?_
+ * check data against ack_in
+ * channel suspend/wake. 3 cong modes state machine - ???
+ * minimize the number of template instantiations
+ * Channel thinks how much it HINTs a second,
+ picker thinks which HINTs are snubbed
#else
#include <arpa/inet.h>
#endif
+#define RND_DROP 10
#include <glog/logging.h>
#include "datagram.h"
}
int Datagram::Send () {
- if (rand()%10==0) {
+#ifdef RND_DROP
+ if (rand()%RND_DROP==0) {
Time();
dprintf("%s datagram killed\n",TimeStr());
return size();
}
+#endif
int r = sendto(sock,(const char *)buf+offset,length-offset,0,
(struct sockaddr*)&(addr.addr),sizeof(struct sockaddr_in));
//offset=0;
}
virtual bin64_t Pick (bins& offer, uint8_t layer) {
-
+
bin64_t hint = offer.find_filtered
(ack_hint_out_,bin64_t::ALL,layer,bins::FILLED);
if (hint==bin64_t::NONE)
}
virtual void Expired (bins& b) {
- ack_hint_out_.remove(b);
+ ack_hint_out_.remove(b); // may invalidate
}
};
uint8_t layer = 2; // actually, enough
bin64_t hint = file().picker().Pick(ack_in_,layer);
- // FIXME: any layer
+ // FIXME FIXME FIXME: any layer
if (hint==bin64_t::NONE)
hint = file().picker().Pick(ack_in_,0);
TEST(P2TP,CwndTest) {
+
+ srand ( time(NULL) );
unlink("doc/sofi-copy.jpg");
struct stat st;
p2tp::Loop(TINT_SEC);
int count = 0;
- while (p2tp::SeqComplete(copy)!=size && count++<20)
+ while (p2tp::SeqComplete(copy)!=size && count++<600)
p2tp::Loop(TINT_SEC);
ASSERT_EQ(size,p2tp::SeqComplete(copy));