git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Produce debug output only if SMUX_DEBUG is defined
[stg.git]
/
projects
/
stargazer
/
store_loader.cpp
diff --git
a/projects/stargazer/store_loader.cpp
b/projects/stargazer/store_loader.cpp
index 11fd804fa8801b2a4f31a8400b563858056153bd..c54bdb361cc2e0b0dfb9884ce1f080dcfa873fc3 100644
(file)
--- a/
projects/stargazer/store_loader.cpp
+++ b/
projects/stargazer/store_loader.cpp
@@
-30,12
+30,12
@@
#include <dlfcn.h>
#include <dlfcn.h>
+#include "stg/common.h"
+#include "stg/store.h"
#include "store_loader.h"
#include "store_loader.h"
-#include "common.h"
-#include "store.h"
-#include "settings.h"
+#include "settings_impl.h"
-STORE_LOADER::STORE_LOADER(const SETTINGS & settings)
+STORE_LOADER::STORE_LOADER(const SETTINGS
_IMPL
& settings)
: isLoaded(false),
handle(NULL),
plugin(NULL),
: isLoaded(false),
handle(NULL),
plugin(NULL),
@@
-52,16
+52,17
@@
Unload();
bool STORE_LOADER::Load()
{
bool STORE_LOADER::Load()
{
-printfd(__FILE__, "STORE_LOADER::Load()\n");
if (isLoaded)
{
if (isLoaded)
{
+ errorStr = "Store plugin '" + pluginFileName + "' was already loaded!";
+ printfd(__FILE__, "STORE_LOADER::Load() - %s\n", errorStr.c_str());
return false;
}
if (pluginFileName.empty())
{
errorStr = "Empty store plugin filename";
return false;
}
if (pluginFileName.empty())
{
errorStr = "Empty store plugin filename";
- printfd(__FILE__, "STORE_LOADER::Load - %s\n", errorStr.c_str());
+ printfd(__FILE__, "STORE_LOADER::Load
()
- %s\n", errorStr.c_str());
return true;
}
return true;
}
@@
-71,18
+72,18
@@
if (!handle)
{
errorStr = "Error loading plugin '"
+ pluginFileName + "': '" + dlerror() + "'";
{
errorStr = "Error loading plugin '"
+ pluginFileName + "': '" + dlerror() + "'";
- printfd(__FILE__, "STORE_LOADER::Load - %s\n", errorStr.c_str());
+ printfd(__FILE__, "STORE_LOADER::Load
()
- %s\n", errorStr.c_str());
return true;
}
isLoaded = true;
return true;
}
isLoaded = true;
-
BASE_
STORE * (*GetStore)();
-GetStore = (
BASE_
STORE * (*)())dlsym(handle, "GetStore");
+STORE * (*GetStore)();
+GetStore = (STORE * (*)())dlsym(handle, "GetStore");
if (!GetStore)
{
if (!GetStore)
{
- errorStr =
"GetStore not found."
;
- printfd(__FILE__, "STORE_LOADER::Load - %s\n", errorStr.c_str());
+ errorStr =
std::string("GetStore() not found! ") + dlerror()
;
+ printfd(__FILE__, "STORE_LOADER::Load
()
- %s\n", errorStr.c_str());
return true;
}
return true;
}
@@
-90,8
+91,8
@@
plugin = GetStore();
if (!plugin)
{
if (!plugin)
{
- errorStr = "
NULL store plugin
";
- printfd(__FILE__, "STORE_LOADER::Load - %s\n");
+ errorStr = "
Plugin was not created!
";
+ printfd(__FILE__, "STORE_LOADER::Load
()
- %s\n");
return true;
}
return true;
}
@@
-99,7
+100,7
@@
plugin->SetSettings(storeSettings);
if (plugin->ParseSettings())
{
errorStr = plugin->GetStrError();
if (plugin->ParseSettings())
{
errorStr = plugin->GetStrError();
- printfd(__FILE__, "Failed to parse settings. Plugin reports: '%s'\n", errorStr.c_str());
+ printfd(__FILE__, "
STORE_LOADER::Load() -
Failed to parse settings. Plugin reports: '%s'\n", errorStr.c_str());
return true;
}
return true;
}
@@
-111,15
+112,15
@@
bool STORE_LOADER::Unload()
printfd(__FILE__, "STORE_LOADER::Unload()\n");
if (!isLoaded)
{
printfd(__FILE__, "STORE_LOADER::Unload()\n");
if (!isLoaded)
{
- return
fals
e;
+ return
tru
e;
}
if (dlclose(handle))
{
}
if (dlclose(handle))
{
- errorStr = "Failed to unload plugin: '";
+ errorStr = "Failed to unload plugin '";
+ errorStr += pluginFileName + "': ";
errorStr += dlerror();
errorStr += dlerror();
- errorStr += "'";
- printfd(__FILE__, "STORE_LOADER::Unload - %s\n", errorStr.c_str());
+ printfd(__FILE__, "STORE_LOADER::Unload() - %s\n", errorStr.c_str());
return true;
}
return true;
}