]> pilppa.org Git - libplpbus.git/blobdiff - src/plpbus/ServerEventThread.cc
cleanups
[libplpbus.git] / src / plpbus / ServerEventThread.cc
index f0cb4dce2f2d6c87c3f0473a5d7f131ed6094cb7..9660597bd971cdfcf277b2e12ac92b5f8a872cc9 100644 (file)
@@ -5,20 +5,20 @@
  *      Author: lamikr
  */
 
-//////////////////////////////////////////////////////////////////////
-
 // A thread object used to server clients registered
 // using the plpbus_orb::OrbServer::register() method.
+#include <plp/log.h>
+
 #include "BusServer.hh"
 #include "ServerEventThread.hh"
+
 using namespace std;
 using namespace plpbus;
 
 ServerEventThread::ServerEventThread(plpbus_orb::OrbClient_ptr client,
-       const char      *msg,
-       int             period,
-       OrbServerImpl   *server_obj)
-{
+                               const char      *msg,
+                               int             period,
+                               OrbServerImpl   *server_obj) {
        this->_orb_client       = plpbus_orb::OrbClient::_duplicate(client);
        this->_orb_msg          = msg;
        this->_interval         = period;
@@ -26,8 +26,7 @@ ServerEventThread::ServerEventThread(plpbus_orb::OrbClient_ptr client,
        _orb_client->receive_event_message("event_listener_started");
 }
 
-void ServerEventThread::run(void* arg)
-{
+void ServerEventThread::run(void* arg) {
        try {
                while(_server_obj->is_shutdown_pending() == 0) {
                        omni_thread::sleep(_interval);
@@ -35,8 +34,10 @@ void ServerEventThread::run(void* arg)
                }
        }
        catch(...) {
-               cout << "server_thread failed, could not connect to client!" << endl;
+               log_error("server_thread failed, could not connect to client!\n");
+       }
+       log_debug("server_thread, closing\n");
+       if (_server_obj != NULL) {
+               _server_obj->server_thread_closed();
        }
-       cout << "server_thread, closing" << endl;
-       _server_obj->server_thread_closed();
 }