diff --git a/mainapp.cpp b/mainapp.cpp
index 40625be..938abe4 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -30,6 +30,8 @@ License along with FlashMQ. If not, see .
#include "logger.h"
#include "threadglobals.h"
#include "threadloop.h"
+#include "authplugin.h"
+#include "threadglobals.h"
MainApp *MainApp::instance = nullptr;
@@ -432,6 +434,9 @@ void MainApp::start()
std::vector packetQueueIn;
std::vector subtopics;
+ Authentication auth(settingsLocalCopy);
+ ThreadGlobals::assign(&auth);
+
std::shared_ptr threaddata(new ThreadData(0, subscriptionStore, settings));
std::shared_ptr client(new Client(fd, threaddata, nullptr, fuzzWebsockets, nullptr, settings, true));
@@ -484,7 +489,8 @@ void MainApp::start()
}
// Populate the $SYS topics, otherwise you have to wait until the timer expires.
- threads.front()->queuePublishStatsOnDollarTopic(threads);
+ if (!threads.empty())
+ threads.front()->queuePublishStatsOnDollarTopic(threads);
uint next_thread_index = 0;