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;
|
PluginTable::iterator it;
|
||||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||||
cleanupFunc cleanup = (cleanupFunc)dlsym(it->second, "cleanup");
|
cleanupFunc cleanup = (cleanupFunc)dlsym(it->second, "cleanup");
|
||||||
|
if (cleanup != NULL) {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||||
dlclose(it->second);
|
dlclose(it->second);
|
||||||
}
|
}
|
||||||
|
@ -103,8 +109,13 @@ ArchPluginUnix::init(void* log, void* arch)
|
||||||
PluginTable::iterator it;
|
PluginTable::iterator it;
|
||||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||||
initFunc initPlugin = (initFunc)dlsym(it->second, "init");
|
initFunc initPlugin = (initFunc)dlsym(it->second, "init");
|
||||||
|
if (initPlugin != NULL) {
|
||||||
initPlugin(log, arch);
|
initPlugin(log, arch);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -116,8 +127,13 @@ ArchPluginUnix::initEvent(void* eventTarget, IEventQueue* events)
|
||||||
PluginTable::iterator it;
|
PluginTable::iterator it;
|
||||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||||
initEventFunc initEventPlugin = (initEventFunc)dlsym(it->second, "initEvent");
|
initEventFunc initEventPlugin = (initEventFunc)dlsym(it->second, "initEvent");
|
||||||
|
if (initEventPlugin != NULL) {
|
||||||
initEventPlugin(&sendEvent);
|
initEventPlugin(&sendEvent);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_DEBUG "no init event function in %s", it->first.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -138,7 +154,14 @@ ArchPluginUnix::invoke(
|
||||||
it = m_pluginTable.find(plugin);
|
it = m_pluginTable.find(plugin);
|
||||||
if (it != m_pluginTable.end()) {
|
if (it != m_pluginTable.end()) {
|
||||||
invokeFunc invokePlugin = (invokeFunc)dlsym(it->second, "invoke");
|
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 {
|
else {
|
||||||
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
|
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++) {
|
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||||
cleanupFunc cleanup = (cleanupFunc)GetProcAddress(lib, "cleanup");
|
cleanupFunc cleanup = (cleanupFunc)GetProcAddress(lib, "cleanup");
|
||||||
|
if (cleanup != NULL) {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_DEBUG "no cleanup function in %s", it->first.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
LOG((CLOG_DEBUG "unloading plugin: %s", it->first.c_str()));
|
||||||
FreeLibrary(lib);
|
FreeLibrary(lib);
|
||||||
}
|
}
|
||||||
|
@ -91,8 +97,13 @@ ArchPluginWindows::init(void* log, void* arch)
|
||||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||||
initFunc initPlugin = (initFunc)GetProcAddress(lib, "init");
|
initFunc initPlugin = (initFunc)GetProcAddress(lib, "init");
|
||||||
|
if (initPlugin != NULL) {
|
||||||
initPlugin(log, arch);
|
initPlugin(log, arch);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
LOG((CLOG_DEBUG "no init function in %s", it->first.c_str()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -106,8 +117,13 @@ ArchPluginWindows::initEvent(void* eventTarget, IEventQueue* events)
|
||||||
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
for (it = m_pluginTable.begin(); it != m_pluginTable.end(); it++) {
|
||||||
lib = reinterpret_cast<HINSTANCE>(it->second);
|
lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||||
initEventFunc initEventPlugin = (initEventFunc)GetProcAddress(lib, "initEvent");
|
initEventFunc initEventPlugin = (initEventFunc)GetProcAddress(lib, "initEvent");
|
||||||
|
if (initEventPlugin != NULL) {
|
||||||
initEventPlugin(&sendEvent);
|
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()) {
|
if (it != m_pluginTable.end()) {
|
||||||
HINSTANCE lib = reinterpret_cast<HINSTANCE>(it->second);
|
HINSTANCE lib = reinterpret_cast<HINSTANCE>(it->second);
|
||||||
invokeFunc invokePlugin = (invokeFunc)GetProcAddress(lib, "invoke");
|
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 {
|
else {
|
||||||
LOG((CLOG_DEBUG "invoke command failed, plugin: %s command: %s",
|
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);
|
SSL_set_fd(m_ssl->m_ssl, socket);
|
||||||
|
|
||||||
// do SSL-protocol accept
|
// do SSL-protocol accept
|
||||||
LOG((CLOG_DEBUG "secureAccept"));
|
LOG((CLOG_DEBUG1 "secureAccept"));
|
||||||
int r = SSL_accept(m_ssl->m_ssl);
|
int r = SSL_accept(m_ssl->m_ssl);
|
||||||
bool retry = checkResult(r);
|
bool retry = checkResult(r);
|
||||||
|
|
||||||
|
@ -241,9 +241,9 @@ SecureSocket::secureConnect(int socket)
|
||||||
|
|
||||||
// attach the socket descriptor
|
// attach the socket descriptor
|
||||||
SSL_set_fd(m_ssl->m_ssl, socket);
|
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);
|
bool retry = checkResult(r);
|
||||||
|
|
||||||
//TODO: don't use this infinite loop
|
//TODO: don't use this infinite loop
|
||||||
|
|
Loading…
Reference in New Issue