Some fixes
This commit is contained in:
+20
-27
@@ -1,6 +1,7 @@
|
||||
#include <client/linux/handler/exception_handler.h>
|
||||
#include <iostream>
|
||||
#include <misc/endianness.h>
|
||||
#include <misc/strobf.h>
|
||||
#include <CXXTerminal/QuickTerminal.h>
|
||||
#include <event2/thread.h>
|
||||
#include <log/LogUtils.h>
|
||||
@@ -119,13 +120,6 @@ int main(int argc, char** argv) {
|
||||
OpenSSL_add_ssl_algorithms();
|
||||
ts::permission::setup_permission_resolve();
|
||||
|
||||
{
|
||||
u_char buffer[SHA512_DIGEST_LENGTH];
|
||||
SHA512_CTX md{};
|
||||
SHA512_Init(&md);
|
||||
SHA512_Update(&md, "Hello World", 11);
|
||||
SHA512_Final(buffer,&md);
|
||||
}
|
||||
{
|
||||
auto evthread_use_pthreads_result = evthread_use_pthreads();
|
||||
assert(evthread_use_pthreads_result == 0);
|
||||
@@ -241,18 +235,18 @@ int main(int argc, char** argv) {
|
||||
std::string descriptors = "LTGE";
|
||||
bool crypt_init = false;
|
||||
for(const auto& c : descriptors)
|
||||
if(crypt_init |= crypt_mp_init(&c))
|
||||
if((crypt_init |= crypt_mp_init(&c)))
|
||||
break;
|
||||
if(!crypt_init) {
|
||||
logCritical(LOG_GENERAL, "Could not initialise libtomcrypt mp descriptors!");
|
||||
return 1;
|
||||
}
|
||||
if(register_prng(&sprng_desc) == -1) {
|
||||
cerr << "could not setup prng" << endl;
|
||||
logCritical(LOG_GENERAL, "could not setup prng");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (register_cipher(&rijndael_desc) == -1) {
|
||||
cerr << "could not setup rijndael" << endl;
|
||||
logCritical(LOG_GENERAL, "could not setup rijndael");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
testTomMath();
|
||||
@@ -263,18 +257,17 @@ int main(int argc, char** argv) {
|
||||
shared_ptr<logger::LoggerConfig> logConfig = nullptr;
|
||||
std::string line;
|
||||
|
||||
logMessage("Loading configuration");
|
||||
terminal::instance()->writeMessage("Loading configuration");
|
||||
logMessageFmt(true, LOG_GENERAL, "Loading configuration");
|
||||
auto cfgErrors = ts::config::parseConfig(CONFIG_NAME);
|
||||
if(!cfgErrors.empty()){
|
||||
logError("Could not load configuration. Errors: (" + to_string(cfgErrors.size()) + ")");
|
||||
logErrorFmt(true, LOG_GENERAL, "Could not load configuration. Errors: (" + to_string(cfgErrors.size()) + ")");
|
||||
for(const auto& entry : cfgErrors)
|
||||
logError(" - " + entry);
|
||||
logError("Stopping server...");
|
||||
logError(true, LOG_GENERAL, " - {}", entry);
|
||||
logErrorFmt(true, LOG_GENERAL, "Stopping server...");
|
||||
goto stopApp;
|
||||
}
|
||||
|
||||
logMessage("Setting up log");
|
||||
logMessage(LOG_GENERAL, "Setting up logging");
|
||||
logConfig = make_shared<logger::LoggerConfig>();
|
||||
logConfig->logfileLevel = (spdlog::level::level_enum) ts::config::log::logfileLevel;
|
||||
logConfig->terminalLevel = (spdlog::level::level_enum) ts::config::log::terminalLevel;
|
||||
@@ -291,23 +284,23 @@ int main(int argc, char** argv) {
|
||||
|
||||
logger::updateLogLevels();
|
||||
if(ts::config::license_original && ts::config::license_original->data.type != license::LicenseType::DEMO){
|
||||
logMessageFmt(true, LOG_GENERAL, "[]---------------------------------------------------------[]");
|
||||
logMessageFmt(true, LOG_GENERAL, " §aThank you for buying the TeaSpeak-§lPremium-§aSoftware! ");
|
||||
logMessageFmt(true, LOG_GENERAL, " §aLicense information:");
|
||||
logMessageFmt(true, LOG_GENERAL, " §aLicense owner : §e" + ts::config::license_original->owner());
|
||||
logMessageFmt(true, LOG_GENERAL, " §aLicense type : §e" + license::LicenseTypeNames[ts::config::license_original->data.type]);
|
||||
logMessageFmt(true, LOG_GENERAL, strobf("[]---------------------------------------------------------[]").string());
|
||||
logMessageFmt(true, LOG_GENERAL, strobf(" §aThank you for buying the TeaSpeak-§lPremium-§aSoftware! ").string());
|
||||
logMessageFmt(true, LOG_GENERAL, strobf(" §aLicense information:").string());
|
||||
logMessageFmt(true, LOG_GENERAL, strobf(" §aLicense owner : §e").string() + ts::config::license_original->owner());
|
||||
logMessageFmt(true, LOG_GENERAL, strobf(" §aLicense type : §e").string() + license::LicenseTypeNames[ts::config::license_original->data.type]);
|
||||
|
||||
if(ts::config::license_original->end().time_since_epoch().count() == 0){
|
||||
logMessageFmt(true, LOG_GENERAL, " §aLicense expires: §enever");
|
||||
logMessageFmt(true, LOG_GENERAL, strobf(" §aLicense expires: §enever").string());
|
||||
} else {
|
||||
char timeBuffer[32];
|
||||
time_t t = duration_cast<seconds>(ts::config::license_original->end().time_since_epoch()).count();
|
||||
tm* stime = localtime(&t);
|
||||
strftime(timeBuffer, 32, "%c", stime);
|
||||
logMessageFmt(true, LOG_GENERAL, " §aLicense expires: §e" + string(timeBuffer));
|
||||
logMessageFmt(true, LOG_GENERAL, strobf(" §aLicense expires: §e").string() + string(timeBuffer));
|
||||
}
|
||||
logMessage(string() + " §aLicense valid : " + (ts::config::license_original->isValid() ? "§ayes" : "§cno"));
|
||||
logMessageFmt(true, LOG_GENERAL, "[]---------------------------------------------------------[]");
|
||||
logMessage(string() + strobf(" §aLicense valid : ").string() + (ts::config::license_original->isValid() ? strobf("§ayes").string() : strobf("§cno").string()));
|
||||
logMessageFmt(true, LOG_GENERAL, strobf("[]---------------------------------------------------------[]").string());
|
||||
}
|
||||
|
||||
logMessage(LOG_GENERAL, "Starting TeaSpeak-Server v{}", build::version()->string(true));
|
||||
@@ -400,7 +393,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
|
||||
stopApp:
|
||||
logMessage("Stopping application");
|
||||
logMessageFmt(true, LOG_GENERAL, "Stopping application");
|
||||
if(serverInstance)
|
||||
serverInstance->stopInstance();
|
||||
delete serverInstance;
|
||||
@@ -410,7 +403,7 @@ int main(int argc, char** argv) {
|
||||
if(sql)
|
||||
sql->finalize();
|
||||
delete sql;
|
||||
logMessage("Application suspend successful!");
|
||||
logMessageFmt(true, LOG_GENERAL, "Application suspend successful!");
|
||||
|
||||
logger::uninstall();
|
||||
terminal::uninstall();
|
||||
|
||||
Reference in New Issue
Block a user