diff --git a/libdevcore/Log.cpp b/libdevcore/Log.cpp index fde492f3b..96cda820e 100644 --- a/libdevcore/Log.cpp +++ b/libdevcore/Log.cpp @@ -24,6 +24,9 @@ #include #include #include +#ifdef __APPLE__ +#include +#endif #include #include "Guards.h" using namespace std; @@ -168,7 +171,7 @@ extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* l string dev::getThreadName() { -#ifdef __linux__ +#if defined(__linux__) || defined(__APPLE__) char buffer[128]; pthread_getname_np(pthread_self(), buffer, 127); buffer[127] = 0; @@ -180,8 +183,10 @@ string dev::getThreadName() void dev::setThreadName(string const& _n) { -#ifdef __linux__ +#if defined(__linux__) pthread_setname_np(pthread_self(), _n.c_str()); +#elsif defined(__APPLE__) + pthread_setname_np(_n.c_str()); #else g_logThreadName.m_name.reset(new std::string(_n)); #endif diff --git a/libp2p/RLPxHandshake.h b/libp2p/RLPxHandshake.h index 6ed0819c6..82d2a6f44 100644 --- a/libp2p/RLPxHandshake.h +++ b/libp2p/RLPxHandshake.h @@ -74,7 +74,7 @@ public: void start() { transition(); } /// Cancels handshake preventing - void cancel() { m_cancel = true; } + void cancel() { m_cancel = true; m_socket->close(); } protected: /// Write Auth message to socket and transitions to AckAuth.