examples: Fix compilation warning

This commit is contained in:
Sébastien Deronne
2018-06-21 22:22:14 +02:00
parent b0fdf9be01
commit 7c128bc929

View File

@@ -217,22 +217,31 @@ int main (int argc, char *argv[])
uint64_t rxBytes;
double throughput;
bool error = false;
if (apHasTraffic)
{
rxBytes = payloadSize * DynamicCast<UdpServer> (staServerApp.Get (0))->GetReceived ();
throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
std::cout << "AP Throughput: " << throughput << " Mbit/s" << std::endl;
if (throughput == 0)
{
error = true;
}
}
if (staHasTraffic)
{
rxBytes = payloadSize * DynamicCast<UdpServer> (apServerApp.Get (0))->GetReceived ();
throughput = (rxBytes * 8) / (simulationTime * 1000000.0); //Mbit/s
std::cout << "STA Throughput: " << throughput << " Mbit/s" << std::endl;
if (throughput == 0)
{
error = true;
}
}
Simulator::Destroy ();
if (throughput == 0)
if (error)
{
NS_LOG_ERROR ("No traffic received!");
exit (1);