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