diff --git a/httpd/Request.h b/httpd/Request.h index 5e4909df9..8466071c8 100644 --- a/httpd/Request.h +++ b/httpd/Request.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include namespace httpd @@ -33,27 +33,27 @@ namespace { Method methodFromString(const char* method) { - if (strncmp(method, "GET", 3) == 0) + if (std::strncmp(method, "GET", 3) == 0) { return Method::GET; } - else if (strncmp(method, "POST", 4) == 0) + else if (std::strncmp(method, "POST", 4) == 0) { return Method::POST; } - else if (strncmp(method, "DELETE", 6) == 0) + else if (std::strncmp(method, "DELETE", 6) == 0) { return Method::DELETE; } - else if (strncmp(method, "PATCH", 5) == 0) + else if (std::strncmp(method, "PATCH", 5) == 0) { return Method::PATCH; } - else if (strncmp(method, "OPTIONS", 7) == 0) + else if (std::strncmp(method, "OPTIONS", 7) == 0) { return Method::OPTIONS; } - else if (strncmp(method, "PUT", 3) == 0) + else if (std::strncmp(method, "PUT", 3) == 0) { return Method::PUT; } diff --git a/test/integration/emulator/FakeUdpEndpoint.cpp b/test/integration/emulator/FakeUdpEndpoint.cpp index 2d7e67d0f..f801650c2 100644 --- a/test/integration/emulator/FakeUdpEndpoint.cpp +++ b/test/integration/emulator/FakeUdpEndpoint.cpp @@ -257,6 +257,7 @@ bool FakeUdpEndpoint::openPort(uint16_t port) } _localPort.setPort(port); + logger::info("adding %s to network", "FakeUdpEndpoint", _localPort.toString().c_str()); _network->addLocal(this); _state = Endpoint::State::CREATED; return true; @@ -341,10 +342,6 @@ void FakeUdpEndpoint::onReceive(fakenet::Protocol protocol, bool FakeUdpEndpoint::hasIp(const transport::SocketAddress& target) { - if (_state != State::CONNECTED) - { - return false; - } return target == _localPort; } diff --git a/test/transport/FakeNetwork.cpp b/test/transport/FakeNetwork.cpp index 5b287c45d..95be6f6bd 100644 --- a/test/transport/FakeNetwork.cpp +++ b/test/transport/FakeNetwork.cpp @@ -143,9 +143,18 @@ void Internet::process(const uint64_t timestamp) packet->data, packet->length, timestamp); + packet.reset(); break; } } + if (packet) + { + logger::debug("no destination for %s, %zuB, nodes %zu", + "Internet", + packet->target.toString().c_str(), + packet->length, + _nodes.size()); + } } { @@ -276,7 +285,7 @@ void Firewall::dispatchNAT(const Packet& packet, const uint64_t timestamp) toString(packet.protocol), packet.source.toString().c_str(), packet.target.toString().c_str(), - mapping.first.toString().c_str()); + portPair->lanPort.ipToString().c_str()); endpoint->onReceive(packet.protocol, packet.source, portPair->lanPort, @@ -373,7 +382,9 @@ transport::SocketAddress Firewall::acquirePortMapping(const Protocol protocol, c } auto publicAddress = (source.getFamily() == AF_INET6 ? _publicIpv6 : _publicIpv4); - while (portMap.contains(transport::SocketAddress(publicAddress, ++_portCount))) {} + while (portMap.contains(transport::SocketAddress(publicAddress, ++_portCount))) + { + } return addPortMapping(protocol, source, _portCount); } @@ -521,6 +532,7 @@ std::shared_ptr InternetRunner::getNetwork() void InternetRunner::internetThreadRun() { concurrency::setThreadName("Internet"); + logger::info("internet thread started at interval %" PRIu64, "InternetRunner", _tickInterval); while (_command != quit) { if (_command == State::running) @@ -531,12 +543,14 @@ void InternetRunner::internetThreadRun() } else if (_command == paused) { + logger::info("internet thread paused...", "InternetRunner"); _state = paused; while (_command == paused) { // check in to TimeTurner if enabled utils::Time::nanoSleep(utils::Time::ms * 10); } + logger::info("internet thread resumed...", "InternetRunner"); } } } diff --git a/test/transport/JitterTest.cpp b/test/transport/JitterTest.cpp index fa55bc5ee..527262562 100644 --- a/test/transport/JitterTest.cpp +++ b/test/transport/JitterTest.cpp @@ -168,8 +168,8 @@ TEST(Welford, normal) sqrt(w2.getVariance())); } } - EXPECT_NEAR(w2.getMean(), 500.0, 20.0); - EXPECT_NEAR(w2.getVariance(), 100.0 * 100, 2500.0); + EXPECT_NEAR(w2.getMean(), 500.0, 25.0); + EXPECT_NEAR(w2.getVariance(), 100.0 * 100, 2900.0); } class JitterBufferTest : public ::testing::Test diff --git a/utils/Span.h b/utils/Span.h index b41b6f5b5..926b0cef6 100644 --- a/utils/Span.h +++ b/utils/Span.h @@ -1,5 +1,6 @@ #pragma once +#include #include #include namespace utils