summaryrefslogtreecommitdiff
path: root/testnet.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-28 17:25:34 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-10-28 17:25:34 -0700
commit5bb854e504a0db968b47c0a983d0148629e126e7 (patch)
treedc16e7f9f66fdc00683ad85b3ef126630f9c06be /testnet.cpp
parentfaff84e63a2d58dd110015cfd3d6f5111756cefe (diff)
downloadinfinitytier-5bb854e504a0db968b47c0a983d0148629e126e7.tar.gz
infinitytier-5bb854e504a0db968b47c0a983d0148629e126e7.zip
Fix a nasty bug introduced in packet fragmentation a while back during refactoring, and a few other things related to multicast.
Diffstat (limited to 'testnet.cpp')
-rw-r--r--testnet.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/testnet.cpp b/testnet.cpp
index e2f04c67..3fa8aef2 100644
--- a/testnet.cpp
+++ b/testnet.cpp
@@ -559,11 +559,11 @@ static void doUnicast(const std::vector<std::string> &cmd)
SimNode *receiver = nodes[*r];
SharedPtr<TestEthernetTap> rtap(receiver->tapFactory.getByNwid(nwid));
if (rtap) {
- while (rtap->getNextReceivedFrame(frame,1)) {
+ if (rtap->getNextReceivedFrame(frame,5)) {
if ((frame.len == frameLen)&&(!memcmp(frame.data + 16,pkt.data + 16,frameLen - 16))) {
uint64_t ints[2];
memcpy(ints,frame.data,16);
- printf("%s <- %.10llx received test packet, latency == %llums"ZT_EOL_S,r->toString().c_str(),ints[0],frame.timestamp - ints[1]);
+ printf("%s <- %.10llx received test packet, length == %u, latency == %llums"ZT_EOL_S,r->toString().c_str(),ints[0],frame.len,frame.timestamp - ints[1]);
receivedPairs.insert(std::pair<Address,Address>(Address(ints[0]),*r));
} else {
printf("%s !! got spurious packet, length == %u, etherType == 0x%.4x"ZT_EOL_S,r->toString().c_str(),frame.len,frame.etherType);
@@ -647,19 +647,19 @@ static void doMulticast(const std::vector<std::string> &cmd)
printf("---------- waiting %llu seconds..."ZT_EOL_S,tout / 1000ULL);
- uint64_t toutend = Utils::now() + tout;
unsigned int receiveCount = 0;
TestEthernetTap::TestFrame frame;
+ uint64_t toutend = Utils::now() + tout;
do {
for(std::map< Address,SimNode * >::iterator nn(nodes.begin());nn!=nodes.end();++nn) {
SimNode *receiver = nn->second;
SharedPtr<TestEthernetTap> rtap(receiver->tapFactory.getByNwid(nwid));
if (rtap) {
- while (rtap->getNextReceivedFrame(frame,1)) {
+ if (rtap->getNextReceivedFrame(frame,5)) {
if ((frame.len == frameLen)&&(!memcmp(frame.data + 16,pkt.data + 16,frameLen - 16))) {
uint64_t ints[2];
memcpy(ints,frame.data,16);
- printf("%s <- %.10llx received test packet, latency == %llums"ZT_EOL_S,nn->first.toString().c_str(),ints[0],frame.timestamp - ints[1]);
+ printf("%s <- %.10llx received test packet, length == %u, latency == %llums"ZT_EOL_S,nn->first.toString().c_str(),ints[0],frame.len,frame.timestamp - ints[1]);
++receiveCount;
} else {
printf("%s !! got spurious packet, length == %u, etherType == 0x%.4x"ZT_EOL_S,nn->first.toString().c_str(),frame.len,frame.etherType);