File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5353 - name : Build
5454 run : |
5555 rm -rf build
56- cmake -B build . -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON -DENABLE_ASAN=OFF -DBUILD_EXECUTABLE=OFF
56+ cmake -B build . -G Ninja -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON -DENABLE_ASAN=ON -DBUILD_EXECUTABLE=OFF
5757 cmake --build build
5858 cd build && ctest --output-on-failure --verbose
5959
Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ class NoiseService
2424{
2525public:
2626 NoiseService ();
27- ~NoiseService () = default ;
27+ ~NoiseService ();
28+
29+ // Cleanup method
30+ void cleanup ();
2831
2932 // Session management
3033 std::shared_ptr<NoiseSession> createSession (const std::string &peerID, NoiseRole role);
Original file line number Diff line number Diff line change 22#include " bitchat/core/constants.h"
33#include " bitchat/helpers/noise_helper.h"
44#include " bitchat/noise/noise_session_default.h"
5+ #include < openssl/err.h>
6+ #include < openssl/evp.h>
57#include < openssl/rand.h>
68#include < spdlog/spdlog.h>
79
@@ -16,6 +18,24 @@ NoiseService::NoiseService()
1618 }
1719}
1820
21+ NoiseService::~NoiseService ()
22+ {
23+ cleanup ();
24+ }
25+
26+ void NoiseService::cleanup ()
27+ {
28+ std::lock_guard<std::mutex> lock (sessionsMutex);
29+
30+ // Clear all sessions
31+ sessions.clear ();
32+
33+ // Clear OpenSSL
34+ ERR_clear_error ();
35+ EVP_cleanup ();
36+ ERR_free_strings ();
37+ }
38+
1939std::shared_ptr<NoiseSession> NoiseService::createSession (const std::string &peerID, NoiseRole role)
2040{
2141 std::lock_guard<std::mutex> lock (sessionsMutex);
You can’t perform that action at this time.
0 commit comments