Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
5c9c05caff | |||
2573ca151b | |||
c5b5fa82be | |||
80dff08304 | |||
24c2eae3d7 |
3
.github/workflows/unittest_windows_gcc.yml
vendored
3
.github/workflows/unittest_windows_gcc.yml
vendored
@ -20,7 +20,8 @@ jobs:
|
||||
ninja
|
||||
- run: |
|
||||
cd build
|
||||
ninja test
|
||||
ctest -V
|
||||
# ninja test
|
||||
|
||||
#- run: ../build/test/ixwebsocket_unittest.exe
|
||||
# working-directory: test
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
All changes to this project will be documented in this file.
|
||||
|
||||
## [11.2.0] - 2021-03-23
|
||||
|
||||
(ixwebsocket) correct mingw support (gcc on windows)
|
||||
|
||||
## [11.1.4] - 2021-03-23
|
||||
|
||||
(ixwebsocket) add getMinWaitBetweenReconnectionRetries
|
||||
|
@ -124,14 +124,12 @@ namespace ix
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace ix
|
||||
|
||||
//
|
||||
// mingw does not have inet_ntop and inet_pton, which were taken as is from the musl C library.
|
||||
// mingw does not have inet_ntop, which were taken as is from the musl C library.
|
||||
//
|
||||
#if defined(_WIN32) && defined(__GNUC__)
|
||||
const char* inet_ntop(int af, const void* a0, char* s, socklen_t l)
|
||||
{
|
||||
#if defined(_WIN32) && defined(__GNUC__)
|
||||
const unsigned char* a = (const unsigned char*) a0;
|
||||
int i, j, max, best;
|
||||
char buf[100];
|
||||
@ -190,6 +188,9 @@ const char* inet_ntop(int af, const void* a0, char* s, socklen_t l)
|
||||
}
|
||||
errno = ENOSPC;
|
||||
return 0;
|
||||
#else
|
||||
return ::inet_ntop(af, a0, s, l);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int hexval(unsigned c)
|
||||
@ -200,8 +201,12 @@ static int hexval(unsigned c)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//
|
||||
// mingw does not have inet_pton, which were taken as is from the musl C library.
|
||||
//
|
||||
int inet_pton(int af, const char* s, void* a0)
|
||||
{
|
||||
#if defined(_WIN32) && defined(__GNUC__)
|
||||
uint16_t ip[8];
|
||||
unsigned char* a = (unsigned char*) a0;
|
||||
int i, j, v, d, brk = -1, need_v4 = 0;
|
||||
@ -266,5 +271,9 @@ int inet_pton(int af, const char* s, void* a0)
|
||||
}
|
||||
if (need_v4 && inet_pton(AF_INET, (const char*) s, a - 4) <= 0) return 0;
|
||||
return 1;
|
||||
#else
|
||||
return ::inet_pton(af, s, a0);
|
||||
#endif
|
||||
}
|
||||
#endif // defined(_WIN32) && defined(__GNUC__)
|
||||
|
||||
} // namespace ix
|
||||
|
@ -53,12 +53,6 @@ struct pollfd
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// mingw does not have those
|
||||
#if defined(_WIN32) && defined(__GNUC__)
|
||||
const char* inet_ntop(int af, const void* src, char* dst, socklen_t size);
|
||||
int inet_pton(int af, const char* src, void* dst);
|
||||
#endif
|
||||
|
||||
namespace ix
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -71,4 +65,7 @@ namespace ix
|
||||
bool uninitNetSystem();
|
||||
|
||||
int poll(struct pollfd* fds, nfds_t nfds, int timeout);
|
||||
|
||||
const char* inet_ntop(int af, const void* src, char* dst, socklen_t size);
|
||||
int inet_pton(int af, const char* src, void* dst);
|
||||
} // namespace ix
|
||||
|
@ -104,7 +104,7 @@ namespace ix
|
||||
server.sin_family = _addressFamily;
|
||||
server.sin_port = htons(_port);
|
||||
|
||||
if (inet_pton(_addressFamily, _host.c_str(), &server.sin_addr.s_addr) <= 0)
|
||||
if (ix::inet_pton(_addressFamily, _host.c_str(), &server.sin_addr.s_addr) <= 0)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "SocketServer::listen() error calling inet_pton "
|
||||
@ -133,7 +133,7 @@ namespace ix
|
||||
server.sin6_family = _addressFamily;
|
||||
server.sin6_port = htons(_port);
|
||||
|
||||
if (inet_pton(_addressFamily, _host.c_str(), &server.sin6_addr) <= 0)
|
||||
if (ix::inet_pton(_addressFamily, _host.c_str(), &server.sin6_addr) <= 0)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "SocketServer::listen() error calling inet_pton "
|
||||
@ -338,7 +338,7 @@ namespace ix
|
||||
if (_addressFamily == AF_INET)
|
||||
{
|
||||
char remoteIp4[INET_ADDRSTRLEN];
|
||||
if (inet_ntop(AF_INET, &client.sin_addr, remoteIp4, INET_ADDRSTRLEN) == nullptr)
|
||||
if (ix::inet_ntop(AF_INET, &client.sin_addr, remoteIp4, INET_ADDRSTRLEN) == nullptr)
|
||||
{
|
||||
int err = Socket::getErrno();
|
||||
std::stringstream ss;
|
||||
@ -357,7 +357,8 @@ namespace ix
|
||||
else // AF_INET6
|
||||
{
|
||||
char remoteIp6[INET6_ADDRSTRLEN];
|
||||
if (inet_ntop(AF_INET6, &client.sin_addr, remoteIp6, INET6_ADDRSTRLEN) == nullptr)
|
||||
if (ix::inet_ntop(AF_INET6, &client.sin_addr, remoteIp6, INET6_ADDRSTRLEN) ==
|
||||
nullptr)
|
||||
{
|
||||
int err = Socket::getErrno();
|
||||
std::stringstream ss;
|
||||
|
@ -14,7 +14,7 @@ namespace ix
|
||||
bool CaseInsensitiveLess::NocaseCompare::operator()(const unsigned char& c1,
|
||||
const unsigned char& c2) const
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32) && !defined(__GNUC__)
|
||||
return std::tolower(c1, std::locale()) < std::tolower(c2, std::locale());
|
||||
#else
|
||||
return std::tolower(c1) < std::tolower(c2);
|
||||
|
@ -6,4 +6,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define IX_WEBSOCKET_VERSION "11.1.4"
|
||||
#define IX_WEBSOCKET_VERSION "11.2.0"
|
||||
|
@ -113,7 +113,7 @@ test_server:
|
||||
test:
|
||||
mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_TEST=1 ..)
|
||||
(cd build ; ninja)
|
||||
(cd build ; ninja test)
|
||||
(cd build ; ninja -v test)
|
||||
|
||||
test_asan:
|
||||
mkdir -p build && (cd build ; cmake -GNinja -DCMAKE_UNITY_BUILD=ON -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_TEST=1 .. -DCMAKE_C_FLAGS="-fsanitize=address -fno-omit-frame-pointer" -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer")
|
||||
|
Reference in New Issue
Block a user