+bool RADIUS::IsRunning()
+{
+ const std::lock_guard lock(m_mutex);
+ return m_running;
+}
+
+void RADIUS::SetRunning(bool val)
+{
+ const std::lock_guard lock(m_mutex);
+ m_running = val;
+}
+
+int RADIUS::Run(std::stop_token token)
+{
+ SetRunning(true);
+
+ try
+ {
+ if (!m_server)
+ m_server = std::make_unique<Server>(m_ioContext, m_config.GetSecret(), m_config.GetPort(), m_config.GetDictionaries(), std::move(token), m_logger, m_users, m_config);
+ m_ioContext.run();
+ }
+ catch (const std::exception& e)
+ {
+ m_errorStr = "Exception in RADIUS::Run(): " + std::string(e.what());
+ m_logger("Exception in RADIUS:: Run(): %s", e.what());
+ printfd(__FILE__, "Exception in RADIUS:: Run(). Message: '%s'\n", e.what());
+ }
+
+ SetRunning(false);
+ return 0;
+}