mirror of https://github.com/Icinga/icinga2.git
parent
8b1a262086
commit
ca960a0c1a
|
@ -166,10 +166,12 @@ void SocketEvents::WakeUpThread(bool wait)
|
||||||
|
|
||||||
l_SocketIOFDChanged = true;
|
l_SocketIOFDChanged = true;
|
||||||
|
|
||||||
|
while (l_SocketIOFDChanged) {
|
||||||
(void) send(l_SocketIOEventFDs[1], "T", 1, 0);
|
(void) send(l_SocketIOEventFDs[1], "T", 1, 0);
|
||||||
|
|
||||||
while (l_SocketIOFDChanged)
|
boost::system_time const timeout = boost::get_system_time() + boost::posix_time::milliseconds(50);
|
||||||
l_SocketIOCV.wait(lock);
|
l_SocketIOCV.timed_wait(lock, timeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(void) send(l_SocketIOEventFDs[1], "T", 1, 0);
|
(void) send(l_SocketIOEventFDs[1], "T", 1, 0);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
void Stream::RegisterDataHandler(const boost::function<void(void)>& handler)
|
void Stream::RegisterDataHandler(const boost::function<void(const Stream::Ptr&)>& handler)
|
||||||
{
|
{
|
||||||
if (SupportsWaiting())
|
if (SupportsWaiting())
|
||||||
OnDataAvailable.connect(handler);
|
OnDataAvailable.connect(handler);
|
||||||
|
@ -42,7 +42,7 @@ bool Stream::IsDataAvailable(void) const
|
||||||
|
|
||||||
void Stream::SignalDataAvailable(void)
|
void Stream::SignalDataAvailable(void)
|
||||||
{
|
{
|
||||||
OnDataAvailable();
|
OnDataAvailable(this);
|
||||||
|
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock lock(m_Mutex);
|
boost::mutex::scoped_lock lock(m_Mutex);
|
||||||
|
|
|
@ -114,7 +114,7 @@ public:
|
||||||
|
|
||||||
virtual bool IsDataAvailable(void) const;
|
virtual bool IsDataAvailable(void) const;
|
||||||
|
|
||||||
void RegisterDataHandler(const boost::function<void(void)>& handler);
|
void RegisterDataHandler(const boost::function<void(const Stream::Ptr&)>& handler);
|
||||||
|
|
||||||
StreamReadStatus ReadLine(String *line, StreamReadContext& context, bool may_wait = false);
|
StreamReadStatus ReadLine(String *line, StreamReadContext& context, bool may_wait = false);
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ protected:
|
||||||
void SignalDataAvailable(void);
|
void SignalDataAvailable(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::signals2::signal<void(void)> OnDataAvailable;
|
boost::signals2::signal<void(const Stream::Ptr&)> OnDataAvailable;
|
||||||
|
|
||||||
boost::mutex m_Mutex;
|
boost::mutex m_Mutex;
|
||||||
boost::condition_variable m_CV;
|
boost::condition_variable m_CV;
|
||||||
|
|
|
@ -184,10 +184,12 @@ void TlsStream::OnEvent(int revents)
|
||||||
if (rc > 0) {
|
if (rc > 0) {
|
||||||
m_CurrentAction = TlsActionNone;
|
m_CurrentAction = TlsActionNone;
|
||||||
|
|
||||||
|
if (!m_Eof) {
|
||||||
if (m_SendQ->GetAvailableBytes() > 0)
|
if (m_SendQ->GetAvailableBytes() > 0)
|
||||||
ChangeEvents(POLLIN|POLLOUT);
|
ChangeEvents(POLLIN|POLLOUT);
|
||||||
else
|
else
|
||||||
ChangeEvents(POLLIN);
|
ChangeEvents(POLLIN);
|
||||||
|
}
|
||||||
|
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue