mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-02-16 08:20:40 +00:00
Fix segfault in http
This commit is contained in:
@@ -26,7 +26,7 @@ const std::string ErrorString = "-1";
|
||||
namespace Server {
|
||||
void SetupEnvironment();
|
||||
// todo: Add non TLS Server Instance, this one is TLS only
|
||||
class THttpServerInstance : IThreaded {
|
||||
class THttpServerInstance {
|
||||
public:
|
||||
THttpServerInstance();
|
||||
static fs::path KeyFilePath;
|
||||
@@ -42,6 +42,7 @@ namespace Server {
|
||||
* So we need to able to start the server (make it "listen()") in a single Thread.
|
||||
*/
|
||||
std::shared_ptr<httplib::SSLServer> mHttpLibServerInstancePtr;
|
||||
std::thread mThread;
|
||||
};
|
||||
// todo: all of these functions are likely unsafe,
|
||||
// todo: replace with something that's managed by a domain specific crypto library
|
||||
|
||||
@@ -8,11 +8,11 @@ public:
|
||||
IThreaded()
|
||||
// invokes operator() on this object
|
||||
: mThread() { }
|
||||
~IThreaded() noexcept {
|
||||
if (mThread.joinable()) {
|
||||
mThread.join();
|
||||
}
|
||||
~IThreaded() noexcept {
|
||||
if (mThread.joinable()) {
|
||||
mThread.join();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void Start() final {
|
||||
mThread = std::thread([this] { (*this)(); });
|
||||
|
||||
Reference in New Issue
Block a user