Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fs for WASM #2

Open
wants to merge 2 commits into
base: beatrice
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 46 additions & 43 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#
# Defines fc library target.
# Defines fc_pp library target.

PROJECT( fc )
PROJECT( fc_pp )
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 )

MESSAGE(STATUS "Configuring project fc located in: ${CMAKE_CURRENT_SOURCE_DIR}")
MESSAGE(STATUS "Configuring project fc_pp located in: ${CMAKE_CURRENT_SOURCE_DIR}")
SET( CMAKE_AUTOMOC OFF )

# Setup module path to make visible used CMake extensions
Expand All @@ -24,7 +24,7 @@ SET( DEFAULT_LIBRARY_INSTALL_DIR lib/ )
SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ )
SET( CMAKE_DEBUG_POSTFIX _debug )
SET( BUILD_SHARED_LIBS NO )
SET( ECC_IMPL secp256k1 CACHE STRING "secp256k1 or openssl or mixed" )
SET( ECC_IMPL_PP pp_secp256k1 CACHE STRING "pp_secp256k1 or openssl or mixed" )
SET( FC_USE_FULL_ZLIB FALSE CACHE BOOL "TRUE to try to use full zlib for compression, FALSE to use miniz.c")

if( FC_USE_FULL_ZLIB )
Expand All @@ -43,34 +43,34 @@ SET(BOOST_COMPONENTS)
LIST(APPEND BOOST_COMPONENTS thread date_time system filesystem program_options signals serialization chrono unit_test_framework context locale iostreams)
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )

IF( ECC_IMPL STREQUAL openssl )
IF( ECC_IMPL_PP STREQUAL openssl )
SET( ECC_REST src/crypto/elliptic_impl_pub.cpp )
ELSE( ECC_IMPL STREQUAL openssl )
SET( ECC_LIB secp256k1 )
IF( ECC_IMPL STREQUAL mixed )
ELSE( ECC_IMPL_PP STREQUAL openssl )
SET( ECC_LIB pp_secp256k1 )
IF( ECC_IMPL_PP STREQUAL mixed )
SET( ECC_REST src/crypto/elliptic_impl_priv.cpp src/crypto/elliptic_impl_pub.cpp )
ELSE( ECC_IMPL STREQUAL mixed )
ELSE( ECC_IMPL_PP STREQUAL mixed )
SET( ECC_REST src/crypto/elliptic_impl_priv.cpp )
ENDIF( ECC_IMPL STREQUAL mixed )
ENDIF( ECC_IMPL STREQUAL openssl )
ENDIF( ECC_IMPL_PP STREQUAL mixed )
ENDIF( ECC_IMPL_PP STREQUAL openssl )

# Configure secp256k1-zkp
if ( MSVC )
# autoconf won't work here, hard code the defines
set( SECP256K1_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp" )

file( GLOB SECP256K1_SOURCES "${SECP256K1_DIR}/src/secp256k1.c" )
add_library( secp256k1 ${SECP256K1_SOURCES} )
add_library( pp_secp256k1 ${SECP256K1_SOURCES} )

target_include_directories( secp256k1 PRIVATE "${SECP256K1_DIR}" PUBLIC "${SECP256K1_DIR}/include" )
target_include_directories( pp_secp256k1 PRIVATE "${SECP256K1_DIR}" PUBLIC "${SECP256K1_DIR}/include" )

set( SECP256K1_BUILD_DEFINES
USE_FIELD_10X26
USE_FIELD_INV_BUILTIN
USE_NUM_NONE
USE_SCALAR_8X32
USE_SCALAR_INV_BUILTIN )
set_target_properties( secp256k1 PROPERTIES COMPILE_DEFINITIONS "${SECP256K1_BUILD_DEFINES}" LINKER_LANGUAGE C )
set_target_properties( pp_secp256k1 PROPERTIES COMPILE_DEFINITIONS "${SECP256K1_BUILD_DEFINES}" LINKER_LANGUAGE C )
else ( MSVC )
include(ExternalProject)
if ( MINGW )
Expand All @@ -86,6 +86,7 @@ else ( MSVC )
ExternalProject_Add( project_secp256k1
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
PATCH_COMMAND patch -N <SOURCE_DIR>/include/secp256k1.h < ${CMAKE_CURRENT_LIST_DIR}/cmake/secp256k1.patch || true
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp --with-bignum=no
BUILD_COMMAND make
INSTALL_COMMAND true
Expand All @@ -100,16 +101,16 @@ else ( MSVC )

ExternalProject_Get_Property(project_secp256k1 binary_dir)

add_library(secp256k1 STATIC IMPORTED)
set_property(TARGET secp256k1 PROPERTY IMPORTED_LOCATION ${binary_dir}/.libs/libsecp256k1${CMAKE_STATIC_LIBRARY_SUFFIX})
set_property(TARGET secp256k1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp/include)
add_dependencies(secp256k1 project_secp256k1)
add_library(pp_secp256k1 STATIC IMPORTED)
set_property(TARGET pp_secp256k1 PROPERTY IMPORTED_LOCATION ${binary_dir}/.libs/libsecp256k1${CMAKE_STATIC_LIBRARY_SUFFIX})
set_property(TARGET pp_secp256k1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp/include)
add_dependencies(pp_secp256k1 project_secp256k1)
install( FILES ${binary_dir}/.libs/libsecp256k1${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION lib/cryptonomex )
endif ( MSVC )
# End configure secp256k1-zkp

IF( WIN32 )
MESSAGE(STATUS "Configuring fc to build on Win32")
MESSAGE(STATUS "Configuring fc_pp to build on Win32")

set( RPCRT4 rpcrt4 )

Expand All @@ -132,7 +133,7 @@ IF( WIN32 )
# iphlpapi.lib

ELSE(WIN32)
MESSAGE(STATUS "Configuring fc to build on Unix/Apple")
MESSAGE(STATUS "Configuring fc_pp to build on Unix/Apple")

LIST(APPEND BOOST_COMPONENTS coroutine)

Expand Down Expand Up @@ -228,7 +229,7 @@ set( fc_sources
src/crypto/blowfish.cpp
src/crypto/elliptic_common.cpp
${ECC_REST}
src/crypto/elliptic_${ECC_IMPL}.cpp
src/crypto/elliptic_${ECC_IMPL_PP}.cpp
src/crypto/rand.cpp
src/network/tcp_socket.cpp
src/network/udp_socket.cpp
Expand Down Expand Up @@ -256,7 +257,7 @@ list(APPEND sources ${fc_headers})

add_subdirectory( vendor/websocketpp EXCLUDE_FROM_ALL )

setup_library( fc SOURCES ${sources} LIBRARY_TYPE STATIC )
setup_library( fc_pp SOURCES ${sources} LIBRARY_TYPE STATIC )
install( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION include )

# begin readline stuff
Expand All @@ -266,15 +267,15 @@ find_package(Readline)
file(GLOB HEADERS "include/bts/cli/*.hpp")

if (READLINE_FOUND)
target_compile_definitions (fc PRIVATE HAVE_READLINE)
target_compile_definitions (fc_pp PRIVATE HAVE_READLINE)
set(readline_libraries ${Readline_LIBRARY})
if (CURSES_FOUND)
list(APPEND readline_libraries ${CURSES_LIBRARY})
endif()
set(readline_includes ${Readline_INCLUDE_DIR})
endif()
if(WIN32)
target_compile_definitions( fc PRIVATE _CRT_NONSTDC_NO_DEPRECATE )
target_compile_definitions( fc_pp PRIVATE _CRT_NONSTDC_NO_DEPRECATE )
endif(WIN32)
# end readline stuff

Expand All @@ -283,7 +284,7 @@ if( NOT CPP_STANDARD )
endif()

IF(WIN32)
target_compile_definitions(fc PUBLIC WIN32 NOMINMAX _WIN32_WINNT=0x0501 _CRT_SECURE_NO_WARNINGS
target_compile_definitions(fc_pp PUBLIC WIN32 NOMINMAX _WIN32_WINNT=0x0501 _CRT_SECURE_NO_WARNINGS
_SCL_SERCURE_NO_WARNINGS
# Needed to disable MSVC autolinking feature (#pragma comment)
BOOST_ALL_NO_LIB
Expand All @@ -295,24 +296,24 @@ IF(WIN32)
if( MSVC )
# Activate C++ exception handling, assume extern C calls don't throw
# Add /U options to be sure settings specific to dynamic boost link are ineffective
target_compile_options(fc PUBLIC /EHsc /UBOOST_ALL_DYN_LINK /UBOOST_LINKING_PYTHON /UBOOST_DEBUG_PYTHON)
target_compile_options(fc_pp PUBLIC /EHsc /UBOOST_ALL_DYN_LINK /UBOOST_LINKING_PYTHON /UBOOST_DEBUG_PYTHON)
elseif( MINGW )
# Put MinGW specific compiler settings here
endif()
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c++11 -Wall")

IF(APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD} -stdlib=libc++ -Wall")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD} -stdlib=libc++ -std=c++11 -Wall")
ELSE()
if( NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
target_compile_options(fc PUBLIC ${CPP_STANDARD} -Wall -fnon-call-exceptions)
target_compile_options(fc_pp PUBLIC ${CPP_STANDARD} -Wall -fnon-call-exceptions)
endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD} -Wall -fnon-call-exceptions")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STANDARD} -std=c++11 -Wall -fnon-call-exceptions")

if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
if( CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.0.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.0.0 )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-invalid-partial-specialization" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-invalid-partial-specialization" )
endif()
endif()
ENDIF()
Expand Down Expand Up @@ -364,9 +365,9 @@ if( LOG_LONG_API )
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLOG_LONG_API -DLOG_LONG_API_MAX_MS=${LOG_LONG_API_MAX_MS} -DLOG_LONG_API_WARN_MS=${LOG_LONG_API_WARN_MS}" )
endif()

target_include_directories(fc
target_include_directories(fc_pp
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
${Boost_INCLUDE_DIR}
#${Boost_INCLUDE_DIR}
${OPENSSL_INCLUDE_DIR}
"vendor/diff-match-patch-cpp-stl"
${CMAKE_CURRENT_SOURCE_DIR}/vendor/websocketpp
Expand All @@ -375,13 +376,15 @@ target_include_directories(fc
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost_1.51/include
${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
${Boost_INCLUDE_DIR}
)

#target_link_libraries( fc PUBLIC ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${ECC_LIB} )
#target_link_libraries( fc_pp PUBLIC ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${ECC_LIB} )
IF(NOT WIN32)
set(LINK_USR_LOCAL_LIB -L/usr/local/lib)
ENDIF()
target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} )

target_link_libraries( fc_pp PUBLIC ${LINK_USR_LOCAL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} ${pthread_library} )

if(MSVC)
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
Expand All @@ -402,7 +405,7 @@ add_subdirectory(tests)

if(WIN32)
# add addtional import library on windows platform
target_link_libraries( fc PUBLIC crypt32.lib)
target_link_libraries( fc_pp PUBLIC crypt32.lib)

# now generate a list of the DLLs we're using to use during the install process
include (ParseLibraryList)
Expand All @@ -412,7 +415,7 @@ if(WIN32)
OPT Boost_LIBRARIES_RELEASE
GENERAL Boost_LIBRARIES_GENERAL)

#Variable will hold list of .pdb files generated for libraries the 'fc' module is linked to
#Variable will hold list of .pdb files generated for libraries the 'fc_pp' module is linked to
set(INTERFACE_LINK_PDB_RELEASE)

set(SHARED_LIBRARIES_RELEASE)
Expand Down Expand Up @@ -475,10 +478,10 @@ if(WIN32)
endif()
endforeach()

set_property(TARGET fc PROPERTY INTERFACE_LINK_PDB_RELEASE ${INTERFACE_LINK_PDB_RELEASE})
set_property(TARGET fc PROPERTY INTERFACE_LINK_PDB_DEBUG ${INTERFACE_LINK_PDB_DEBUG})
set_property(TARGET fc PROPERTY SHARED_LIBRARIES_DEBUG ${SHARED_LIBRARIES_DEBUG})
set_property(TARGET fc PROPERTY SHARED_LIBRARIES_RELEASE ${SHARED_LIBRARIES_RELEASE})
set_property(TARGET fc_pp PROPERTY INTERFACE_LINK_PDB_RELEASE ${INTERFACE_LINK_PDB_RELEASE})
set_property(TARGET fc_pp PROPERTY INTERFACE_LINK_PDB_DEBUG ${INTERFACE_LINK_PDB_DEBUG})
set_property(TARGET fc_pp PROPERTY SHARED_LIBRARIES_DEBUG ${SHARED_LIBRARIES_DEBUG})
set_property(TARGET fc_pp PROPERTY SHARED_LIBRARIES_RELEASE ${SHARED_LIBRARIES_RELEASE})

endif(WIN32)

Expand All @@ -501,8 +504,8 @@ ENDIF()
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENSSL_CONF_SOURCE}" "${OPENSSL_CONF_TARGET}/openssl.cnf")
ENDIF(WIN32)

ADD_CUSTOM_COMMAND(TARGET fc POST_BUILD ${POST_BUILD_STEP_COMMANDS}
ADD_CUSTOM_COMMAND(TARGET fc_pp POST_BUILD ${POST_BUILD_STEP_COMMANDS}
COMMENT "Copying OpenSSL/ssl/openssl.cnf into target directory."
)

MESSAGE(STATUS "Finished fc module configuration...")
MESSAGE(STATUS "Finished fc_pp module configuration...")
48 changes: 48 additions & 0 deletions cmake/secp256k1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
--- secp256k1.h 2018-12-19 19:16:54.613042000 +0300
+++ secp256k1.h 2018-12-19 18:53:50.867984000 +0300
@@ -7,6 +7,45 @@

#include <stdint.h>

+#define secp256k1_context_create secp256k1_context_create_pp
+#define secp256k1_context_clone secp256k1_context_clone_pp
+#define secp256k1_context_destroy secp256k1_context_destroy_pp
+#define secp256k1_context_randomize secp256k1_context_randomize_pp
+
+#define secp256k1_ecdsa_verify secp256k1_ecdsa_verify_pp
+#define secp256k1_ecdsa_sign secp256k1_ecdsa_sign_pp
+#define secp256k1_ecdsa_sig_sign secp256k1_ecdsa_sig_sign_pp
+#define secp256k1_ecdsa_sign_compact secp256k1_ecdsa_sign_compact_pp
+#define secp256k1_ecdsa_recover_compact secp256k1_ecdsa_recover_compact_pp
+
+#define secp256k1_ec_seckey_verify secp256k1_ec_seckey_verify_pp
+#define secp256k1_ec_pubkey_create secp256k1_ec_pubkey_create_pp
+#define secp256k1_ec_privkey_tweak_add secp256k1_ec_privkey_tweak_add_pp
+#define secp256k1_ec_pubkey_tweak_add secp256k1_ec_pubkey_tweak_add_pp
+#define secp256k1_ec_privkey_tweak_mul secp256k1_ec_privkey_tweak_mul_pp
+#define secp256k1_ec_pubkey_tweak_mul secp256k1_ec_pubkey_tweak_mul_pp
+#define secp256k1_ec_pubkey_verify secp256k1_ec_pubkey_verify_pp
+#define secp256k1_ec_pubkey_decompress secp256k1_ec_pubkey_decompress_pp
+#define secp256k1_ec_privkey_export secp256k1_ec_privkey_export_pp
+#define secp256k1_ec_privkey_import secp256k1_ec_privkey_import_pp
+
+#define secp256k1_nonce_function_default secp256k1_nonce_function_default_pp
+#define secp256k1_nonce_function_rfc6979 secp256k1_nonce_function_rfc6979_pp
+
+#define secp256k1_borromean_verify secp256k1_borromean_verify_pp
+#define secp256k1_borromean_sign secp256k1_borromean_sign_pp
+
+#define secp256k1_point_multiply secp256k1_point_multiply_pp
+
+#define secp256k1_pedersen_commit secp256k1_pedersen_commit_pp
+#define secp256k1_pedersen_blind_sum secp256k1_pedersen_blind_sum_pp
+#define secp256k1_pedersen_verify_tally secp256k1_pedersen_verify_tally_pp
+
+#define secp256k1_rangeproof_info secp256k1_rangeproof_info_pp
+#define secp256k1_rangeproof_rewind secp256k1_rangeproof_rewind_pp
+#define secp256k1_rangeproof_verify secp256k1_rangeproof_verify_pp
+#define secp256k1_rangeproof_sign secp256k1_rangeproof_sign_pp
+
# if !defined(SECP256K1_GNUC_PREREQ)
# if defined(__GNUC__)&&defined(__GNUC_MINOR__)
# define SECP256K1_GNUC_PREREQ(_maj,_min) \
1 change: 1 addition & 0 deletions include/fc/crypto/sha256.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ namespace std

namespace boost
{
template<typename T> class hash;
template<>
struct hash<fc::sha256>
{
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/log/file_appender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <iomanip>
#include <queue>
#include <sstream>
#include <iostream>

namespace fc {

Expand Down
10 changes: 5 additions & 5 deletions src/network/tcp_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ namespace fc {
keepalive_settings.keepaliveinterval = (ULONG)(interval.count() / fc::milliseconds(1).count());

DWORD dwBytesRet = 0;
if (WSAIoctl(my->_sock.native(), SIO_KEEPALIVE_VALS, &keepalive_settings, sizeof(keepalive_settings),
if (WSAIoctl(my->_sock.native_handle(), SIO_KEEPALIVE_VALS, &keepalive_settings, sizeof(keepalive_settings),
NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
wlog("Error setting TCP keepalive values");
#elif !defined(__clang__) || (__clang_major__ >= 6)
// This should work for modern Linuxes and for OSX >= Mountain Lion
int timeout_sec = interval.count() / fc::seconds(1).count();
if (setsockopt(my->_sock.native(), IPPROTO_TCP,
if (setsockopt(my->_sock.native_handle(), IPPROTO_TCP,
#if defined( __APPLE__ )
TCP_KEEPALIVE,
#else
Expand All @@ -192,7 +192,7 @@ namespace fc {
(char*)&timeout_sec, sizeof(timeout_sec)) < 0)
wlog("Error setting TCP keepalive idle time");
# if !defined(__APPLE__) || defined(TCP_KEEPINTVL) // TCP_KEEPINTVL not defined before 10.9
if (setsockopt(my->_sock.native(), IPPROTO_TCP, TCP_KEEPINTVL,
if (setsockopt(my->_sock.native_handle(), IPPROTO_TCP, TCP_KEEPINTVL,
(char*)&timeout_sec, sizeof(timeout_sec)) < 0)
wlog("Error setting TCP keepalive interval");
# endif // !__APPLE__ || TCP_KEEPINTVL
Expand Down Expand Up @@ -224,7 +224,7 @@ namespace fc {
if (detail::have_so_reuseport)
{
int reuseport_value = 1;
if (setsockopt(my->_sock.native(), SOL_SOCKET, SO_REUSEPORT,
if (setsockopt(my->_sock.native_handle(), SOL_SOCKET, SO_REUSEPORT,
(char*)&reuseport_value, sizeof(reuseport_value)) < 0)
{
if (errno == ENOPROTOOPT)
Expand Down Expand Up @@ -291,7 +291,7 @@ namespace fc {
if (detail::have_so_reuseport)
{
int reuseport_value = 1;
if (setsockopt(my->_accept.native(), SOL_SOCKET, SO_REUSEPORT,
if (setsockopt(my->_accept.native_handle(), SOL_SOCKET, SO_REUSEPORT,
(char*)&reuseport_value, sizeof(reuseport_value)) < 0)
{
if (errno == ENOPROTOOPT)
Expand Down
11 changes: 9 additions & 2 deletions src/thread/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

#if BOOST_VERSION >= 105400
# include <boost/coroutine/stack_context.hpp>
namespace bc = boost::context;
#if BOOST_VERSION >= 106100
namespace bc = boost::context::detail;
# else
namespace bc = boost::context;
# endif
namespace bco = boost::coroutines;
# if BOOST_VERSION >= 105600 && !defined(NDEBUG)
# include <boost/assert.hpp>
Expand Down Expand Up @@ -47,8 +51,11 @@ namespace fc {
bco::stack_context stack_ctx;
#endif


#if BOOST_VERSION >= 106100
context( void (*sf)(bc::transfer_t), stack_allocator& alloc, fc::thread* t )
#else
context( void (*sf)(intptr_t), stack_allocator& alloc, fc::thread* t )
#endif
: caller_context(0),
stack_alloc(&alloc),
next_blocked(0),
Expand Down
Loading