From: Stephen Seo Date: Mon, 27 Apr 2020 10:34:04 +0000 (+0900) Subject: Minor fixes X-Git-Tag: 1.0~64 X-Git-Url: https://git.seodisparate.com/stephenseo/client_config?a=commitdiff_plain;h=d3fb621406728fe4539e1b5d7d4515572f768fbc;p=UDPConnection Minor fixes --- diff --git a/src/UDPConnection.cpp b/src/UDPConnection.cpp index b498088..85aa9a6 100644 --- a/src/UDPConnection.cpp +++ b/src/UDPConnection.cpp @@ -1954,6 +1954,7 @@ UDPC_ConnectionId UDPC_create_id_hostname(const char *hostname, uint16_t port) { hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; + hints.ai_protocol = IPPROTO_UDP; addrinfo *lookupResult; int error = getaddrinfo(hostname, nullptr, &hints, &lookupResult); @@ -3058,7 +3059,7 @@ UDPC_IPV6_ADDR_TYPE UDPC_a4toa6(uint32_t a4_be) { uint32_t a4 = ntohl(a4_be); - if(a4 == 0x0100007F) { + if(a4 == 0x7F000001) { return in6addr_loopback; } diff --git a/src/test/TestUDPC.cpp b/src/test/TestUDPC.cpp index a8d1ddc..e0e0f76 100644 --- a/src/test/TestUDPC.cpp +++ b/src/test/TestUDPC.cpp @@ -321,7 +321,7 @@ TEST(UDPC, NetworkOrderEndianness) { TEST(UDPC, a4toa6) { EXPECT_EQ(UDPC_a4toa6(0), in6addr_any); - uint32_t a4 = htonl(0x0100007F); + uint32_t a4 = htonl(0x7F000001); EXPECT_EQ(UDPC_a4toa6(a4), in6addr_loopback); UDPC_IPV6_ADDR_TYPE a6 = UDPC_strtoa("::FFFF:0102:0304");