fix build: Trivial changes to fix emumba_deribit build
* Use "Unix Makefiles" generator when building websocket-library.
- Ninja tries to build things in parallel, and doesn't build the
ExternalProject dependencies in the right order. Consequently, the
websocket-library build fails because it can't find "libspdlog.a".
* Replace a few leftover SPDLOG_ERROR macros w/ LOG_ERROR (the latter
logs in our system, not spdlog).
This commit is contained in:
1 parent
11ff46a056
commit
9deb8cc237
8 files changed
+83
-301
No files matched your search
@@ -0,0 +1,25 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if(NOT TARGET websocket-library_project)
|
||||
ExternalProject_Add(websocket-library_project
|
||||
GIT_REPOSITORY https://fintech.websocket:h_ubh-4dsWRB569wwKyg@gitlab.com/cryptoexchanges1/websocket-client-using-epoll.git
|
||||
GIT_TAG enhancement/config-ssl
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/websocket-library
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DLOG_LEVEL=INFO
|
||||
-DENABLE_ENCRYPTION=True
|
||||
)
|
||||
endif()
|
||||
|
||||
ExternalProject_Get_Property(websocket-library_project BINARY_DIR)
|
||||
ExternalProject_Get_Property(websocket-library_project SOURCE_DIR)
|
||||
|
||||
set(websocket-library_INCLUDE_DIR ${SOURCE_DIR}/include)
|
||||
set(websocket-library_LIB_DIR ${BINARY_DIR}/src)
|
||||
|
||||
add_library(websocket-library STATIC IMPORTED)
|
||||
|
||||
set_property(TARGET websocket-library PROPERTY IMPORTED_LOCATION ${websocket-library_LIB_DIR}/libemumba-websocket-library.a)
|
||||
add_dependencies(websocket-library websocket-library_project)
|
||||
install(FILES ${websocket-library_LIB_DIR}/libemumba-websocket-library.a DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
@@ -13,8 +13,8 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
|
||||
find_package(spdlog REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${spdlog_INCLUDE_DIR})
|
||||
target_link_directories(${PROJECT_NAME} PUBLIC ${spdlog_LIB_DIR})
|
||||
add_dependencies(${PROJECT_NAME} spdlog_project::spdlog)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog_project::spdlog)
|
||||
add_dependencies(${PROJECT_NAME} spdlog)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog)
|
||||
|
||||
find_package(websocket-library REQUIRED)
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${websocket-library_INCLUDE_DIR})
|
||||
|
||||
@@ -1,64 +1,32 @@
|
||||
include(ExternalProject)
|
||||
|
||||
# Define the external project
|
||||
ExternalProject_Add(spdlog_project
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/external/spdlog
|
||||
set(_flags "-fno-omit-frame-pointer -DNDEBUG -O3")
|
||||
if(NOT TARGET spdlog_project)
|
||||
ExternalProject_Add(spdlog_project
|
||||
GIT_REPOSITORY https://github.com/gabime/spdlog.git
|
||||
GIT_TAG v1.5.0 # Specify the version you want
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/external/spdlog/install
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DSPDLOG_BUILD_SHARED=OFF # Set to ON if you want shared library
|
||||
-DSPDLOG_BUILD_TESTS=OFF # Disable tests for faster build
|
||||
-DSPDLOG_BUILD_EXAMPLES=OFF
|
||||
GIT_TAG v1.5.0
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spdlog
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
-DSPDLOG_BUILD_EXAMPLE=OFF
|
||||
-DSPDLOG_BUILD_EXAMPLE_HO=OFF
|
||||
-DSPDLOG_BUILD_TESTS=OFF
|
||||
-DSPDLOG_BUILD_TESTS_HO=OFF
|
||||
-DCMAKE_CXX_FLAGS_RELEASE=${_flags}
|
||||
)
|
||||
endif()
|
||||
|
||||
# Tell your project to include spdlog headers and link the library
|
||||
add_library(spdlog_project::spdlog INTERFACE)
|
||||
add_dependencies(spdlog_project::spdlog spdlog)
|
||||
# add_library(spdlog STATIC IMPORTED)
|
||||
set_target_properties(spdlog_project::spdlog PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}/external/spdlog/install/include
|
||||
INTERFACE_LINK_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/external/spdlog/install/lib/${CMAKE_STATIC_LIBRARY_PREFIX}spdlog${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
)
|
||||
ExternalProject_Get_Property(spdlog_project BINARY_DIR)
|
||||
ExternalProject_Get_Property(spdlog_project SOURCE_DIR)
|
||||
|
||||
# Ensure your targets depend on spdlog
|
||||
# add_dependencies(spdlog spdlog_project)
|
||||
# target_link_libraries(spdlog_project PRIVATE spdlog::spdlog)
|
||||
set(spdlog_INCLUDE_DIR ${SOURCE_DIR}/include)
|
||||
set(spdlog_LIB_DIR ${BINARY_DIR})
|
||||
|
||||
add_library(spdlog STATIC IMPORTED)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# include(ExternalProject)
|
||||
|
||||
# set(_flags "-fno-omit-frame-pointer -DNDEBUG -O3")
|
||||
# if(NOT TARGET spdlog_project)
|
||||
# ExternalProject_Add(spdlog_project
|
||||
# GIT_REPOSITORY https://github.com/gabime/spdlog.git
|
||||
# GIT_TAG v1.5.0
|
||||
# CMAKE_ARGS
|
||||
# -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spdlog
|
||||
# -DCMAKE_BUILD_TYPE=Release
|
||||
# -DSPDLOG_BUILD_EXAMPLE=OFF
|
||||
# -DSPDLOG_BUILD_EXAMPLE_HO=OFF
|
||||
# -DSPDLOG_BUILD_TESTS=OFF
|
||||
# -DSPDLOG_BUILD_TESTS_HO=OFF
|
||||
# -DCMAKE_CXX_FLAGS_RELEASE=${_flags}
|
||||
# )
|
||||
# endif()
|
||||
|
||||
# # ExternalProject_Get_Property(spdlog_project BINARY_DIR)
|
||||
# # ExternalProject_Get_Property(spdlog_project SOURCE_DIR)
|
||||
|
||||
# # set(spdlog_INCLUDE_DIR ${SOURCE_DIR}/include)
|
||||
# # set(spdlog_LIB_DIR ${BINARY_DIR})
|
||||
|
||||
# add_library(spdlog STATIC IMPORTED)
|
||||
|
||||
# # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-copy")
|
||||
# # set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-deprecated-copy")
|
||||
# set_property(TARGET spdlog PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/libspdlog.a)
|
||||
# # add_dependencies(spdlog spdlog_project)
|
||||
# # install(FILES ${spdlog_LIB_DIR}/libspdlog.a DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
# # install(DIRECTORY ${spdlog_INCLUDE_DIR}/spdlog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-copy")
|
||||
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-deprecated-copy")
|
||||
set_property(TARGET spdlog PROPERTY IMPORTED_LOCATION ${spdlog_LIB_DIR}/libspdlog.a)
|
||||
add_dependencies(spdlog spdlog_project)
|
||||
install(FILES ${spdlog_LIB_DIR}/libspdlog.a DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
install(DIRECTORY ${spdlog_INCLUDE_DIR}/spdlog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
@@ -4,6 +4,7 @@ if(NOT TARGET websocket-library_project)
|
||||
ExternalProject_Add(websocket-library_project
|
||||
GIT_REPOSITORY https://fintech.websocket:h_ubh-4dsWRB569wwKyg@gitlab.com/cryptoexchanges1/websocket-client-using-epoll.git
|
||||
GIT_TAG enhancement/config-ssl
|
||||
CMAKE_GENERATOR "Unix Makefiles"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/websocket-library
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#ifdef ENABLE_BOOST_WEBSOCKET
|
||||
#ifndef ENABLE_BOOST_WEBSOCKET
|
||||
#include "epoll_timer.h"
|
||||
#include "io_handler.h"
|
||||
#endif
|
||||
@@ -136,4 +136,4 @@ namespace deribit_connector {
|
||||
} // namespace deribit_connector
|
||||
} // namespace emumba
|
||||
|
||||
#endif /* SESSION_H */
|
||||
#endif /* SESSION_H */
|
||||
@@ -85,7 +85,9 @@ void emumba::deribit_connector::trader_session::get_cancel_on_disconnect()
|
||||
_writer.EndObject();
|
||||
_writer.EndObject();
|
||||
|
||||
LOG_DEBUG("Get cancel on disconnect request: {}", _str_buff.GetString());
|
||||
LOG_DEBUG(
|
||||
"Get cancel on disconnect request: {}",
|
||||
std::string{_str_buff.GetString()});
|
||||
send_message(_str_buff.GetString());
|
||||
}
|
||||
|
||||
@@ -363,7 +365,9 @@ void emumba::deribit_connector::trader_session::process_get_cancel_on_disconnect
|
||||
}
|
||||
else
|
||||
{
|
||||
SPDLOG_ERROR("Error in response ec.value: {}, ec.message: {}", ec.value(), ec.message());
|
||||
LOG_ERROR(
|
||||
"Error in response ec.value: {}, ec.message: {}", ec.value(),
|
||||
ec.message());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +390,9 @@ void emumba::deribit_connector::trader_session::enable_cancel_on_disconnect()
|
||||
_writer.EndObject();
|
||||
_writer.EndObject();
|
||||
|
||||
LOG_DEBUG("Enable cancel on disconnect request: {}", _str_buff.GetString());
|
||||
LOG_DEBUG(
|
||||
"Enable cancel on disconnect request: {}",
|
||||
std::string{_str_buff.GetString()});
|
||||
send_message(_str_buff.GetString());
|
||||
}
|
||||
|
||||
@@ -410,7 +416,9 @@ void emumba::deribit_connector::trader_session::disable_cancel_on_disconnect()
|
||||
_writer.EndObject();
|
||||
_writer.EndObject();
|
||||
|
||||
LOG_DEBUG("Disable cancel on disconnect request: {}", _str_buff.GetString());
|
||||
LOG_DEBUG(
|
||||
"Disable cancel on disconnect request: {}",
|
||||
std::string{_str_buff.GetString()});
|
||||
send_message(_str_buff.GetString());
|
||||
}
|
||||
|
||||
@@ -425,12 +433,16 @@ void emumba::deribit_connector::trader_session::process_enable_cancel_on_disconn
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Enable cancel on disconnect failed. Result: {}", result.GetString());
|
||||
LOG_ERROR(
|
||||
"Enable cancel on disconnect failed. Result: {}",
|
||||
std::string{result.GetString()});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SPDLOG_ERROR("Error in response ec.value: {}, ec.message: {}", ec.value(), ec.message());
|
||||
LOG_ERROR(
|
||||
"Error in response ec.value: {}, ec.message: {}", ec.value(),
|
||||
ec.message());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,12 +458,16 @@ void emumba::deribit_connector::trader_session::process_disable_cancel_on_discon
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("Disable cancel on disconnect failed. Result: {}", result.GetString());
|
||||
LOG_ERROR(
|
||||
"Disable cancel on disconnect failed. Result: {}",
|
||||
std::string{result.GetString()});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SPDLOG_ERROR("Error in response ec.value: {}, ec.message: {}", ec.value(), ec.message());
|
||||
LOG_ERROR(
|
||||
"Error in response ec.value: {}, ec.message: {}", ec.value(),
|
||||
ec.message());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,7 +552,8 @@ void emumba::deribit_connector::trader_session::process_get_open_orders(
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unknown order state received: {}", order_state);
|
||||
LOG_WARNING(
|
||||
"Unknown order state received: {}", std::string{order_state});
|
||||
}
|
||||
|
||||
const char *time_in_force = each_open_order["time_in_force"].GetString();
|
||||
@@ -558,7 +575,8 @@ void emumba::deribit_connector::trader_session::process_get_open_orders(
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Unknown time in force received: {}", time_in_force);
|
||||
LOG_WARNING(
|
||||
"Unknown time in force received: {}", std::string{time_in_force});
|
||||
}
|
||||
|
||||
const char *side = each_open_order["direction"].GetString();
|
||||
@@ -682,4 +700,4 @@ void emumba::deribit_connector::trader_session::process_create_combo(const emumb
|
||||
}
|
||||
}
|
||||
_trading_listener->on_create_combo(_combo_detail);
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
#include "websocket.h"
|
||||
|
||||
#include "deribit_exception.h"
|
||||
#include "spdlogger.h"
|
||||
|
||||
using websocketpp::lib::bind;
|
||||
using websocketpp::lib::placeholders::_1;
|
||||
using websocketpp::lib::placeholders::_2;
|
||||
|
||||
emumba::connector::websocket::client::websocket(uint id)
|
||||
: _id(id)
|
||||
{
|
||||
client_inst.set_message_handler(bind(&websocket::receive, this, ::_1, ::_2));
|
||||
client_inst.set_open_handler(bind(&websocket::on_connect, this, ::_1));
|
||||
client_inst.set_close_handler(bind(&websocket::on_close_handler, this, ::_1));
|
||||
client_inst.set_socket_init_handler(bind(&websocket::on_set_socket_init_handler, this, ::_1, ::_2));
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::receive(__attribute__((unused)) websocketpp::connection_hdl hdl, message_ptr msg)
|
||||
{
|
||||
LOG_TRACE("Received messsage {} in socket id: {}", msg->get_payload(), _id);
|
||||
receive_cb(msg->get_payload());
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::send(const std::string &send_message)
|
||||
{
|
||||
LOG_TRACE("Sending messsage {} in socket id: {}", send_message, _id);
|
||||
websocketpp::lib::error_code ec;
|
||||
client_inst.send(_connection_hdl, send_message, websocketpp::frame::opcode::text, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR("Error in sending message | Error code: {}, Error message {}", ec.value(), ec.message());
|
||||
close_cb();
|
||||
}
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::send(const char *buff)
|
||||
{
|
||||
std::string send_message(buff);
|
||||
LOG_TRACE("Sending messsage {} in socket id: {}", send_message, _id);
|
||||
websocketpp::lib::error_code ec;
|
||||
client_inst.send(_connection_hdl, send_message, websocketpp::frame::opcode::text, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR("Error in sending message | Error code: {}, Error message {}", ec.value(), ec.message());
|
||||
close_cb();
|
||||
}
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::on_connect(websocketpp::connection_hdl hdl)
|
||||
{
|
||||
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> *socket =
|
||||
(boost::asio::ssl::stream<boost::asio::ip::tcp::socket> *)_socket;
|
||||
boost::asio::ip::tcp::no_delay tcp_no_delay;
|
||||
socket->lowest_layer().get_option(tcp_no_delay);
|
||||
if (tcp_no_delay.value() == false)
|
||||
{
|
||||
tcp_no_delay = boost::asio::ip::tcp::no_delay(true);
|
||||
socket->lowest_layer().set_option(tcp_no_delay);
|
||||
}
|
||||
_connection_hdl = hdl;
|
||||
connect_cb();
|
||||
}
|
||||
|
||||
bool emumba::connector::websocket::client::connect(std::string uri)
|
||||
{
|
||||
try
|
||||
{
|
||||
client_inst.set_access_channels(websocketpp::log::alevel::none);
|
||||
client_inst.clear_access_channels(websocketpp::log::alevel::connect);
|
||||
|
||||
client_inst.init_asio();
|
||||
client_inst.set_tls_init_handler(bind(&on_tls_init));
|
||||
|
||||
if (!socket_connect(uri))
|
||||
{
|
||||
throw emumba::deribit_connector::deribit_exception(
|
||||
emumba::deribit_connector::deribit_exception::error_code::connection_error);
|
||||
}
|
||||
}
|
||||
catch (websocketpp::exception const &e)
|
||||
{
|
||||
LOG_ERROR("Websocket Connect Failed: {} ", e.what());
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::set_connect_callback(on_connect_cb_t fn_in)
|
||||
{
|
||||
connect_cb = fn_in;
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::set_receive_callback(on_receive_cb_t fn_in)
|
||||
{
|
||||
receive_cb = fn_in;
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::set_close_callback(on_close_cb_t fn_in)
|
||||
{
|
||||
close_cb = fn_in;
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::poll()
|
||||
{
|
||||
client_inst.poll();
|
||||
}
|
||||
|
||||
bool emumba::connector::websocket::client::socket_connect(const std::string &uri)
|
||||
{
|
||||
websocketpp::lib::error_code ec;
|
||||
client::connection_ptr con = client_inst.get_connection(uri, ec);
|
||||
if (ec)
|
||||
{
|
||||
LOG_ERROR("could not create connection because: {}", ec.message());
|
||||
return false;
|
||||
}
|
||||
client_inst.connect(con);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool emumba::connector::websocket::client::socket_reconnect(const std::string &uri)
|
||||
{
|
||||
client_inst.reset();
|
||||
websocketpp::lib::error_code ec;
|
||||
auto con = client_inst.get_connection(uri, ec);
|
||||
if (ec)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
client_inst.connect(con);
|
||||
return true;
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::on_close_handler(__attribute__((unused)) websocketpp::connection_hdl hdl)
|
||||
{
|
||||
LOG_ERROR("Connection disrupted id: {}", _id);
|
||||
close_cb();
|
||||
}
|
||||
|
||||
void emumba::connector::websocket::client::on_set_socket_init_handler(
|
||||
__attribute__((unused)) websocketpp::connection_hdl hdl, boost::asio::ssl::stream<boost::asio::ip::tcp::socket> &socket)
|
||||
{
|
||||
_socket = &socket;
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
#ifndef WEBSOCKET_H
|
||||
#define WEBSOCKET_H
|
||||
|
||||
#include <websocketpp/client.hpp>
|
||||
#include <websocketpp/config/asio_client.hpp>
|
||||
|
||||
namespace emumba {
|
||||
namespace connector {
|
||||
class io_handler
|
||||
{
|
||||
};
|
||||
|
||||
namespace websocket {
|
||||
class client
|
||||
{
|
||||
typedef websocketpp::client<websocketpp::config::asio_tls_client> client;
|
||||
typedef std::shared_ptr<boost::asio::ssl::context> context_ptr;
|
||||
typedef websocketpp::config::asio_client::message_type::ptr message_ptr;
|
||||
typedef std::function<void(void)> on_connect_cb_t;
|
||||
typedef std::function<void(std::string)> on_receive_cb_t;
|
||||
typedef std::function<void(void)> on_close_cb_t;
|
||||
|
||||
public:
|
||||
websocket(uint id);
|
||||
void set_connect_callback(on_connect_cb_t fn_in);
|
||||
void set_receive_callback(on_receive_cb_t fn_in);
|
||||
void set_close_callback(on_close_cb_t fn_in);
|
||||
bool connect(std::string uri);
|
||||
void run();
|
||||
void poll();
|
||||
void send(const std::string &send_message);
|
||||
void send(const char *buff);
|
||||
bool socket_connect(const std::string &uri);
|
||||
bool socket_reconnect(const std::string &uri);
|
||||
|
||||
private:
|
||||
uint _id;
|
||||
on_connect_cb_t connect_cb;
|
||||
on_receive_cb_t receive_cb;
|
||||
on_close_cb_t close_cb;
|
||||
client client_inst;
|
||||
websocketpp::connection_hdl _connection_hdl;
|
||||
void * _socket;
|
||||
/**
|
||||
* @brief This message handler will be invoked once for each incoming message. It
|
||||
* prints the message and then sends a copy of the message back to the server.
|
||||
*
|
||||
* @param client_inst
|
||||
* @param hdl
|
||||
* @param msg
|
||||
*/
|
||||
void receive(websocketpp::connection_hdl hdl, message_ptr msg);
|
||||
void on_connect(websocketpp::connection_hdl hdl);
|
||||
void on_close_handler(websocketpp::connection_hdl hdl);
|
||||
void on_set_socket_init_handler(websocketpp::connection_hdl,
|
||||
boost::asio::ssl::stream<boost::asio::ip::tcp::socket> &socket);
|
||||
|
||||
// FIXME
|
||||
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wunused-function\"") static context_ptr
|
||||
on_tls_init()
|
||||
{
|
||||
// establishes a SSL connection
|
||||
context_ptr ctx = std::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::sslv23);
|
||||
|
||||
try
|
||||
{
|
||||
ctx->set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 |
|
||||
boost::asio::ssl::context::no_sslv3 | boost::asio::ssl::context::single_dh_use);
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
// LOG_ERROR("Error in context pointer: {}", e.what());
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
_Pragma("GCC diagnostic pop")
|
||||
};
|
||||
} // namespace websocket
|
||||
|
||||
} // namespace connector
|
||||
} // namespace emumba
|
||||
|
||||
#endif /* WEBSOCKET_H */
|
||||
Reference in new issue
Block a user