WebSocketServer: Store debug setting

This commit is contained in:
tt2468 2021-04-29 08:24:27 -07:00
parent 3ac0f0edee
commit 1cee256cb3
2 changed files with 3 additions and 1 deletions

View File

@ -79,12 +79,13 @@ void WebSocketServer::Start()
}
_serverPort = conf->ServerPort;
_debugEnabled = conf->DebugEnabled;
_authenticationRequired = conf->AuthRequired;
_authenticationSalt = Utils::Crypto::GenerateSalt();
_authenticationSecret = Utils::Crypto::GenerateSecret(conf->ServerPassword.toStdString(), _authenticationSalt);
// Set log levels if debug is enabled
if (conf->DebugEnabled) {
if (_debugEnabled) {
_server.get_alog().set_channels(websocketpp::log::alevel::all);
_server.get_alog().clear_channels(websocketpp::log::alevel::frame_header | websocketpp::log::alevel::frame_payload | websocketpp::log::alevel::control);
_server.get_elog().set_channels(websocketpp::log::elevel::all);

View File

@ -89,6 +89,7 @@ class WebSocketServer : QObject
std::mutex _sessionMutex;
std::map<websocketpp::connection_hdl, WebSocketSession, std::owner_less<websocketpp::connection_hdl>> _sessions;
uint16_t _serverPort;
bool _debugEnabled;
bool _authenticationRequired;
std::string _authenticationSecret;
std::string _authenticationSalt;