added assersions before lib func invoking and adjust log level #4313
This commit is contained in:
parent
85813fd49b
commit
a53dae9be3
|
@ -91,7 +91,13 @@ ArchPluginUnix::unload()
|
|||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
cleanupFunc cleanup = (cleanupFunc)dlsym(it->second, "cleanup");
|
||||
cleanup();
|
||||
if (cleanup != NULL) {
|
||||
cleanup();
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||
dlclose(it->second);
|
||||
}
|
||||
|
@ -103,7 +109,12 @@ ArchPluginUnix::init(void* log, void* arch)
|
|||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
initFunc initPlugin = (initFunc)dlsym(it->second, "init");
|
||||
initPlugin(log, arch);
|
||||
if (initPlugin != NULL) {
|
||||
initPlugin(log, arch);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +127,12 @@ ArchPluginUnix::initEvent(void* eventTarget, IEventQueue* events)
|
|||
PluginTable::iterator it;
|
||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
initEventFunc initEventPlugin = (initEventFunc)dlsym(it->second, "initEvent");
|
||||
initEventPlugin(&sendEvent);
|
||||
if (initEventPlugin != NULL) {
|
||||
initEventPlugin(&sendEvent);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +154,14 @@ ArchPluginUnix::invoke(
|
|||
it = m_pluginTable.find(plugin);
|
||||
if (it != m_pluginTable.end()) {
|
||||
invokeFunc invokePlugin = (invokeFunc)dlsym(it->second, "invoke");
|
||||
return invokePlugin(command, args);
|
||||
void* result = NULL;
|
||||
if (invokePlugin != NULL) {
|
||||
result = invokePlugin(command, args);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no invoke function in %s", it->first.c_str()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
|
||||
|
|
|
@ -77,7 +77,13 @@ ArchPluginWindows::unload()
|
|||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
cleanupFunc cleanup = (cleanupFunc)GetProcAddress(lib, "cleanup");
|
||||
cleanup();
|
||||
if (cleanup != NULL) {
|
||||
cleanup();
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||
FreeLibrary(lib);
|
||||
}
|
||||
|
@ -91,7 +97,12 @@ ArchPluginWindows::init(void* log, void* arch)
|
|||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
initFunc initPlugin = (initFunc)GetProcAddress(lib, "init");
|
||||
initPlugin(log, arch);
|
||||
if (initPlugin != NULL) {
|
||||
initPlugin(log, arch);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +117,12 @@ ArchPluginWindows::initEvent(void* eventTarget, IEventQueue* events)
|
|||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
initEventFunc initEventPlugin = (initEventFunc)GetProcAddress(lib, "initEvent");
|
||||
initEventPlugin(&sendEvent);
|
||||
if (initEventPlugin != NULL) {
|
||||
initEventPlugin(&sendEvent);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +146,15 @@ ArchPluginWindows::invoke(
|
|||
if (it != m_pluginTable.end()) {
|
||||
HINSTANCE lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||
invokeFunc invokePlugin = (invokeFunc)GetProcAddress(lib, "invoke");
|
||||
return invokePlugin(command, args);
|
||||
void* result = NULL;
|
||||
if (invokePlugin != NULL) {
|
||||
result = invokePlugin(command, args);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "no invoke function in %s", it->first.c_str()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
|
||||
|
|
|
@ -218,7 +218,7 @@ SecureSocket::secureAccept(int socket)
|
|||
SSL_set_fd(m_ssl->m_ssl, socket);
|
||||
|
||||
// do SSL-protocol accept
|
||||
LOG((CLOG_DEBUG "secureAccept"));
|
||||
LOG((CLOG_DEBUG1 "secureAccept"));
|
||||
int r = SSL_accept(m_ssl->m_ssl);
|
||||
bool retry = checkResult(r);
|
||||
|
||||
|
@ -241,9 +241,9 @@ SecureSocket::secureConnect(int socket)
|
|||
|
||||
// attach the socket descriptor
|
||||
SSL_set_fd(m_ssl->m_ssl, socket);
|
||||
LOG((CLOG_DEBUG "secureConnect"));
|
||||
int r = SSL_connect(m_ssl->m_ssl);
|
||||
|
||||
LOG((CLOG_DEBUG1 "secureConnect"));
|
||||
int r = SSL_connect(m_ssl->m_ssl);
|
||||
bool retry = checkResult(r);
|
||||
|
||||
//TODO: don't use this infinite loop
|
||||
|
|
Loading…
Reference in New Issue