summaryrefslogtreecommitdiff
path: root/testnet.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-27 18:23:10 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-27 18:23:10 -0700
commit934a575a7447bb34360e9f9f27dace971f811ce5 (patch)
tree5867614349a3714008c68f7dc06b6f2cb09f454d /testnet.cpp
parentfe7b429866693debe0057d81f11e527f61dfd24b (diff)
downloadinfinitytier-934a575a7447bb34360e9f9f27dace971f811ce5.tar.gz
infinitytier-934a575a7447bb34360e9f9f27dace971f811ce5.zip
Testnet seems to work a bit better now...
Diffstat (limited to 'testnet.cpp')
-rw-r--r--testnet.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/testnet.cpp b/testnet.cpp
index cab3248e..be474404 100644
--- a/testnet.cpp
+++ b/testnet.cpp
@@ -510,7 +510,7 @@ static void doUnicast(const std::vector<std::string> &cmd)
for(unsigned int i=0;i<frameLen;++i)
pkt.data[i] = (unsigned char)prng.next32();
- unsigned long sentCount = 0;
+ std::set< std::pair<Address,Address> > sentPairs;
for(std::vector<Address>::iterator s(senders.begin());s!=senders.end();++s) {
for(std::vector<Address>::iterator r(receivers.begin());r!=receivers.end();++r) {
if (*s == *r)
@@ -526,7 +526,7 @@ static void doUnicast(const std::vector<std::string> &cmd)
pkt.i[1] = Utils::now();
stap->injectPacketFromHost(stap->mac(),rtap->mac(),0xdead,pkt.data,frameLen);
printf("%s -> %s etherType 0xdead network %.16llx length %u"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),nwid,frameLen);
- ++sentCount;
+ sentPairs.insert(std::pair<Address,Address>(*s,*r));
} else if (stap) {
printf("%s -> !%s (receiver not a member of %.16llx)"ZT_EOL_S,s->toString().c_str(),r->toString().c_str(),nwid);
} else if (rtap) {
@@ -561,13 +561,13 @@ static void doUnicast(const std::vector<std::string> &cmd)
}
}
Thread::sleep(250);
- } while ((receivedPairs.size() < sentCount)&&(Utils::now() < toutend));
+ } while ((receivedPairs.size() < sentPairs.size())&&(Utils::now() < toutend));
for(std::vector<Address>::iterator s(senders.begin());s!=senders.end();++s) {
for(std::vector<Address>::iterator r(receivers.begin());r!=receivers.end();++r) {
if (*s == *r)
continue;
- if (!receivedPairs.count(std::pair<Address,Address>(*s,*r))) {
+ if ((sentPairs.count(std::pair<Address,Address>(*s,*r)))&&(!receivedPairs.count(std::pair<Address,Address>(*s,*r)))) {
printf("%s <- %s was never received (timed out)"ZT_EOL_S,r->toString().c_str(),s->toString().c_str());
}
}