return IsDataAvailable() || IsEof();
}
-void Stream::SetCorked(bool corked)
-{
- m_Corked = corked;
-}
-
-bool Stream::IsCorked() const
-{
- return m_Corked;
-}
-
static void StreamDummyCallback()
{ }
bool WaitForData();
bool WaitForData(int timeout);
- virtual void SetCorked(bool corked);
- bool IsCorked() const;
-
virtual bool SupportsWaiting() const;
virtual bool IsDataAvailable() const;
boost::mutex m_Mutex;
boost::condition_variable m_CV;
-
- bool m_Corked{false};
};
}
char buffer[64 * 1024];
if (m_CurrentAction == TlsActionNone) {
- bool corked = IsCorked();
- if (!corked && (revents & (POLLIN | POLLERR | POLLHUP)))
+ if (revents & (POLLIN | POLLERR | POLLHUP))
m_CurrentAction = TlsActionRead;
else if (m_SendQ->GetAvailableBytes() > 0 && (revents & POLLOUT))
m_CurrentAction = TlsActionWrite;
else {
- if (corked)
- ChangeEvents(0);
- else
- ChangeEvents(POLLIN);
+ ChangeEvents(POLLIN);
return;
}
lock.unlock();
- while (!IsCorked() && m_RecvQ->IsDataAvailable() && IsHandlingEvents())
+ while (m_RecvQ->IsDataAvailable() && IsHandlingEvents())
SignalDataAvailable();
}
return m_RecvQ->GetAvailableBytes() > 0;
}
-void TlsStream::SetCorked(bool corked)
-{
- Stream::SetCorked(corked);
-
- boost::mutex::scoped_lock lock(m_Mutex);
-
- if (corked)
- m_CurrentAction = TlsActionNone;
- else
- ChangeEvents(POLLIN | POLLOUT);
-}
-
Socket::Ptr TlsStream::GetSocket() const
{
return m_Socket;
bool SupportsWaiting() const override;
bool IsDataAvailable() const override;
- void SetCorked(bool corked) override;
-
bool IsVerifyOK() const;
String GetVerifyError() const;
response.Finish();
m_PendingRequests--;
- m_Stream->SetCorked(false);
}
void HttpServerConnection::DataAvailableHandler()
if (!m_Stream->IsEof()) {
boost::recursive_mutex::scoped_lock lock(m_DataHandlerMutex);
- m_Stream->SetCorked(true);
-
try {
while (ProcessMessage())
; /* empty loop body */
close = true;
}
- m_RequestQueue.Enqueue(std::bind(&Stream::SetCorked, m_Stream, false));
-
/* Request finished, decide whether to explicitly close the connection. */
if (m_CurrentRequest.ProtocolVersion == HttpVersion10 ||
m_CurrentRequest.Headers->Get("connection") == "close") {
if (!m_Stream->IsEof()) {
boost::mutex::scoped_lock lock(m_DataHandlerMutex);
- m_Stream->SetCorked(true);
-
try {
while (ProcessMessage())
; /* empty loop body */
return;
}
-
- l_JsonRpcConnectionWorkQueues[m_ID % l_JsonRpcConnectionWorkQueueCount].Enqueue(std::bind(&Stream::SetCorked, m_Stream, false));
} else
close = true;