From f1195d1f04061a17f8f68c4aafdf9099be35269d Mon Sep 17 00:00:00 2001 From: Nicholas Orlowsky Date: Wed, 19 Feb 2025 23:54:15 -0500 Subject: [PATCH 1/2] add shell.nix --- .envrc | 1 + shell.nix | 11 +++++++++++ src/api_main.cpp | 1 + 3 files changed, 13 insertions(+) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..e9a5a69 --- /dev/null +++ b/shell.nix @@ -0,0 +1,11 @@ +{ pkgs ? import {} }: + pkgs.mkShell { + nativeBuildInputs = [ pkgs.pkg-config pkgs.openssl pkgs.libgcc pkgs.boost pkgs.cmake ]; + + shellHook = '' + export OPENSSL_DIR="${pkgs.openssl.dev}" + export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig" + export OPENSSL_NO_VENDOR=1 +export OPENSSL_LIB_DIR="${pkgs.lib.getLib pkgs.openssl}/lib" + ''; +} diff --git a/src/api_main.cpp b/src/api_main.cpp index 4a42858..e7b5366 100644 --- a/src/api_main.cpp +++ b/src/api_main.cpp @@ -7,6 +7,7 @@ #include #include #include +#include using namespace anthracite; From f09b261b6241f66ea364e928ae20a5f19dcbc4a3 Mon Sep 17 00:00:00 2001 From: Nicholas Orlowsky Date: Thu, 20 Feb 2025 13:48:30 -0500 Subject: [PATCH 2/2] ssl fix --- lib/anthracite.cpp | 5 +++-- shell.nix | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/anthracite.cpp b/lib/anthracite.cpp index d10cacb..f1cf31c 100644 --- a/lib/anthracite.cpp +++ b/lib/anthracite.cpp @@ -89,12 +89,13 @@ int listen_loop(int port_number, backends::backend& be, bool tls) { socket::anthracite_socket* client_sock; if (tls){ - client_sock = new socket::openssl_socket(*dynamic_cast(socket)); + socket::openssl_socket* ssl_sock = dynamic_cast(socket); + client_sock = new socket::openssl_socket(*ssl_sock); } else { client_sock = new socket::anthracite_socket(*socket); } - std::thread(handle_client, socket, std::ref(be), std::ref(fb), std::ref(thread_wait_mutex), std::ref(thread_wait_condvar), std::ref(active_threads)).detach(); + std::thread(handle_client, client_sock, std::ref(be), std::ref(fb), std::ref(thread_wait_mutex), std::ref(thread_wait_condvar), std::ref(active_threads)).detach(); } delete socket; diff --git a/shell.nix b/shell.nix index e9a5a69..201b9ef 100644 --- a/shell.nix +++ b/shell.nix @@ -6,6 +6,6 @@ export OPENSSL_DIR="${pkgs.openssl.dev}" export PKG_CONFIG_PATH="${pkgs.openssl.dev}/lib/pkgconfig" export OPENSSL_NO_VENDOR=1 -export OPENSSL_LIB_DIR="${pkgs.lib.getLib pkgs.openssl}/lib" + export OPENSSL_LIB_DIR="${pkgs.lib.getLib pkgs.openssl}/lib" ''; }