diff --git a/src/lib/barrier/ClientApp.cpp b/src/lib/barrier/ClientApp.cpp index 15416f60..8a97f5e9 100644 --- a/src/lib/barrier/ClientApp.cpp +++ b/src/lib/barrier/ClientApp.cpp @@ -455,6 +455,11 @@ ClientApp::mainLoop() initIpcClient(); } + // setup polling for stdin if not running in daemon mode + if (!argsBase().m_daemon) { + initStdinListen(); + } + // run event loop. if startClient() failed we're supposed to retry // later. the timer installed by startClient() will take care of // that. diff --git a/src/lib/barrier/ServerApp.cpp b/src/lib/barrier/ServerApp.cpp index 32966bbd..ed634803 100644 --- a/src/lib/barrier/ServerApp.cpp +++ b/src/lib/barrier/ServerApp.cpp @@ -721,6 +721,11 @@ ServerApp::mainLoop() initIpcClient(); } + // setup polling for stdin if not running in daemon mode + if (!argsBase().m_daemon) { + initStdinListen(); + } + // handle hangup signal by reloading the server's configuration ARCH->setSignalHandler(Arch::kHANGUP, &reloadSignalHandler, NULL); m_events->adoptHandler(m_events->forServerApp().reloadConfig(), diff --git a/src/lib/base/EventQueue.cpp b/src/lib/base/EventQueue.cpp index b17e35bf..908ed439 100644 --- a/src/lib/base/EventQueue.cpp +++ b/src/lib/base/EventQueue.cpp @@ -201,12 +201,14 @@ EventQueue::adoptBuffer(IEventQueueBuffer* buffer) } } +/* bool EventQueue::parent_requests_shutdown() const { char ch; return m_parentStream.try_read_char(ch) && ch == ShutdownCh; } +*/ bool EventQueue::getEvent(Event& event, double timeout) @@ -214,10 +216,12 @@ EventQueue::getEvent(Event& event, double timeout) Stopwatch timer(true); retry: // before handling any events make sure we don't need to shutdown +/* if (parent_requests_shutdown()) { event = Event(Event::kQuit); return false; } +*/ // if no events are waiting then handle timers and then wait while (m_buffer->isEmpty()) { // handle timers first diff --git a/src/lib/base/EventQueue.h b/src/lib/base/EventQueue.h index 97e7fba7..a3980f2f 100644 --- a/src/lib/base/EventQueue.h +++ b/src/lib/base/EventQueue.h @@ -26,7 +26,7 @@ #include "base/Stopwatch.h" #include "common/stdmap.h" #include "common/stdset.h" -#include "base/NonBlockingStream.h" +//#include "base/NonBlockingStream.h" #include @@ -73,7 +73,7 @@ private: bool hasTimerExpired(Event& event); double getNextTimerTimeout() const; void addEventToBuffer(const Event& event); - bool parent_requests_shutdown() const; + //bool parent_requests_shutdown() const; private: class Timer { @@ -186,7 +186,7 @@ private: Mutex* m_readyMutex; CondVar* m_readyCondVar; std::queue m_pending; - NonBlockingStream m_parentStream; + //NonBlockingStream m_parentStream; }; #define EVENT_TYPE_ACCESSOR(type_) \