X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/0d1120fd953249ad6292b8684a2accb8890fb4ef..18caba20e60d31488fc27402515a811f689b0672:/projects/sgauthstress/main.cpp diff --git a/projects/sgauthstress/main.cpp b/projects/sgauthstress/main.cpp index 3460457a..71388477 100644 --- a/projects/sgauthstress/main.cpp +++ b/projects/sgauthstress/main.cpp @@ -31,8 +31,10 @@ #include "stg/ia.h" #include "stg/common.h" +#include "stg/store.h" #include "settings.h" +#include "store_loader.h" time_t stgTime; bool running; @@ -42,7 +44,7 @@ bool running; //----------------------------------------------------------------------------- void Usage() { -std::cout << "sgauth " << std::endl; +std::cout << "Usage:\n\nsgauth " << std::endl; } //----------------------------------------------------------------------------- void StatUpdate(const LOADSTAT &, void *) @@ -99,14 +101,32 @@ if (argc == 2) if (settings.ReadSettings()) { - std::cerr << "Failed to read settings\n" - << settings.GetStrError() << std::endl; + std::cerr << "Failed to read settings: '" + << settings.GetStrError() << "'" << std::endl; Usage(); return -1; } SetSignalHandlers(); +STORE_LOADER storeLoader(settings.GetModulesPath(), settings.GetStoreModuleSettings()); +if (storeLoader.Load()) + { + std::cerr << "Failed to load storage plugin: '" << storeLoader.GetStrError() << "'" << std::endl; + return -1; + } + +STORE * dataStore = storeLoader.GetStore(); + +std::vector userList; +if (dataStore->GetUsersList(&userList)) + { + std::cerr << "Failed to get user list: '" << dataStore->GetStrError() << "'" << std::endl; + return -1; + } + +std::cout << "Successfully loaded " << userList.size() << " users" << std::endl; + IA_CLIENT_PROT proto(settings.GetServerName(), settings.GetServerPort(), settings.GetLocalPort()); proto.SetLogin(settings.GetLogin()); @@ -131,6 +151,8 @@ proto.Disconnect(); proto.Stop(); +storeLoader.Unload(); + return 0; } //-----------------------------------------------------------------------------