Fixes for Termux

pull/166/head
SChernykh 2 years ago
parent 8aebcdc580
commit 6b4640c413

@ -100,7 +100,7 @@ if (WIN32)
elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) elseif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(LIBS ${LIBS} pthread) set(LIBS ${LIBS} pthread)
elseif (NOT APPLE) elseif (NOT APPLE)
set(LIBS ${LIBS} pthread gss dl) set(LIBS ${LIBS} pthread dl)
endif() endif()
if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) if (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
@ -133,6 +133,14 @@ endif()
add_definitions(/DZMQ_STATIC) add_definitions(/DZMQ_STATIC)
include(CheckSymbolExists)
check_symbol_exists(pthread_cancel pthread.h HAVE_PTHREAD_CANCEL)
if (HAVE_PTHREAD_CANCEL)
add_definitions(/DHAVE_PTHREAD_CANCEL)
endif()
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES}) add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})
if (STATIC_BINARY) if (STATIC_BINARY)

@ -27,6 +27,10 @@
#include "side_chain.h" #include "side_chain.h"
#include <iostream> #include <iostream>
#ifdef HAVE_PTHREAD_CANCEL
#include <pthread.h>
#endif
static constexpr char log_category_prefix[] = "ConsoleCommands "; static constexpr char log_category_prefix[] = "ConsoleCommands ";
namespace p2pool { namespace p2pool {
@ -45,7 +49,7 @@ ConsoleCommands::~ConsoleCommands()
#ifdef _WIN32 #ifdef _WIN32
TerminateThread(reinterpret_cast<HANDLE>(m_worker->native_handle()), 0); TerminateThread(reinterpret_cast<HANDLE>(m_worker->native_handle()), 0);
#else #elif defined HAVE_PTHREAD_CANCEL
pthread_cancel(m_worker->native_handle()); pthread_cancel(m_worker->native_handle());
#endif #endif

@ -417,7 +417,7 @@ void P2PServer::load_peer_list()
addrinfo hints{}; addrinfo hints{};
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG; hints.ai_flags = AI_ADDRCONFIG;
addrinfo* result; addrinfo* result;
const int err = getaddrinfo(nodes[i], nullptr, &hints, &result); const int err = getaddrinfo(nodes[i], nullptr, &hints, &result);

@ -349,7 +349,7 @@ bool resolve_host(std::string& host, bool& is_v6)
addrinfo hints{}; addrinfo hints{};
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG; hints.ai_flags = AI_ADDRCONFIG;
addrinfo* r = nullptr; addrinfo* r = nullptr;
const int err = getaddrinfo(host.c_str(), nullptr, &hints, &r); const int err = getaddrinfo(host.c_str(), nullptr, &hints, &r);

Loading…
Cancel
Save