Commit 2b435964 authored by Matthieu Kermagoret's avatar Matthieu Kermagoret
Browse files

Connector SSH: we will move connected classes to the observer pattern.

parent 46421a31
......@@ -122,24 +122,24 @@ endif ()
set(CONNECTORLIB "centreonconnectorssh")
add_library("${CONNECTORLIB}"
# Sources.
"${SRC_DIR}/channel.cc"
# "${SRC_DIR}/channel.cc"
"${SRC_DIR}/check_result.cc"
"${SRC_DIR}/commander.cc"
"${SRC_DIR}/credentials.cc"
# "${SRC_DIR}/commander.cc"
# "${SRC_DIR}/credentials.cc"
"${SRC_DIR}/multiplexer.cc"
"${SRC_DIR}/session.cc"
"${SRC_DIR}/sessions.cc"
"${SRC_DIR}/socket_handle.cc"
# "${SRC_DIR}/session.cc"
# "${SRC_DIR}/sessions.cc"
# "${SRC_DIR}/socket_handle.cc"
# Headers.
"${INC_DIR}/channel.hh"
# "${INC_DIR}/channel.hh"
"${INC_DIR}/check_result.hh"
"${INC_DIR}/commander.hh"
"${INC_DIR}/credentials.hh"
# "${INC_DIR}/commander.hh"
# "${INC_DIR}/credentials.hh"
"${INC_DIR}/multiplexer.hh"
"${INC_DIR}/namespace.hh"
"${INC_DIR}/session.hh"
"${INC_DIR}/sessions.hh"
"${INC_DIR}/socket_handle.hh"
# "${INC_DIR}/namespace.hh"
# "${INC_DIR}/session.hh"
# "${INC_DIR}/sessions.hh"
# "${INC_DIR}/socket_handle.hh"
)
target_link_libraries(
"${CONNECTORLIB}"
......@@ -225,14 +225,6 @@ if (WITH_TESTING)
target_link_libraries("${TEST_NAME}" "${CONNECTORLIB}")
add_test("${TEST_NAME}" "${TEST_NAME}")
# commander tests.
# Check singleton.
set(TEST_NAME "commander_singleton")
add_executable("${TEST_NAME}"
"${TEST_DIR}/commander/singleton.cc")
target_link_libraries("${TEST_NAME}" "${CONNECTORLIB}")
add_test("${TEST_NAME}" "${TEST_NAME}")
else()
set(BUILD_UNIT_TEST "No")
endif ()
......
......@@ -21,7 +21,6 @@
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include "com/centreon/connector/ssh/commander.hh"
#include "com/centreon/connector/ssh/multiplexer.hh"
#include "com/centreon/exceptions/basic.hh"
#include "com/centreon/logging/logger.hh"
......@@ -61,7 +60,6 @@ int main() {
// Initializations.
logging::engine::load();
multiplexer::load();
commander::load();
#if LIBSSH2_VERSION_NUM >= 0x010205
// Initialize libssh2.
......@@ -74,26 +72,14 @@ int main() {
logging::info(logging::medium) << "installing termination handler";
signal(SIGTERM, term_handler);
// Listener of commands.
commander::instance().reg();
// Multiplexing loop.
logging::info(logging::medium) << "starting multiplexing loop";
while (!should_exit)
multiplexer::instance().multiplex();
logging::info(logging::medium) << "multiplexing loop terminated";
// Remove command listener on input.
logging::debug(logging::high)
<< "commander will stop listening on input";
commander::instance().unreg(false);
// Wait for remaining sessions.
// XXX : multiplexer.remaining() > 1 || multiplexer.want_write()
// Remove command listener totally.
logging::debug(logging::high) << "removing command listener";
commander::instance().unreg();
// XXX
// Set return value.
retval = EXIT_SUCCESS;
......@@ -108,7 +94,6 @@ int main() {
#endif /* libssh2 version >= 1.2.5 */
// Deinitializations.
commander::unload();
multiplexer::unload();
logging::engine::unload();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment