From af47beebfcd4821b6b627f8aea453fd58e5d44c5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 27 Dec 2023 14:22:51 +1100 Subject: [PATCH] AP_Networking: fixed discard test on PPP and fixed byte order bug --- libraries/AP_Networking/AP_Networking_address.cpp | 2 +- libraries/AP_Networking/AP_Networking_tests.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/AP_Networking/AP_Networking_address.cpp b/libraries/AP_Networking/AP_Networking_address.cpp index ddb36428e1..93997479f1 100644 --- a/libraries/AP_Networking/AP_Networking_address.cpp +++ b/libraries/AP_Networking/AP_Networking_address.cpp @@ -72,7 +72,7 @@ void AP_Networking_IPV4::set_default_uint32(uint32_t v) const char* AP_Networking_IPV4::get_str() { - const auto ip = ntohl(get_uint32()); + const auto ip = get_uint32(); return SocketAPM::inet_addr_to_str(ip, strbuf, sizeof(strbuf)); } diff --git a/libraries/AP_Networking/AP_Networking_tests.cpp b/libraries/AP_Networking/AP_Networking_tests.cpp index d4c33f9806..5630126105 100644 --- a/libraries/AP_Networking/AP_Networking_tests.cpp +++ b/libraries/AP_Networking/AP_Networking_tests.cpp @@ -113,10 +113,10 @@ void AP_Networking::test_TCP_discard(void) return; } // connect to the discard service, which is port 9 - if (!sock->connect(dest, 9)) { - GCS_SEND_TEXT(MAV_SEVERITY_ERROR, "TCP_discard: connect failed"); - return; + while (!sock->connect(dest, 9)) { + hal.scheduler->delay(10); } + GCS_SEND_TEXT(MAV_SEVERITY_INFO, "TCP_discard: connected"); const uint32_t bufsize = 1024; uint8_t *buf = (uint8_t*)malloc(bufsize); for (uint32_t i=0; i