if (desc.second.Events == 0)
continue;
- if (desc.second.EventInterface)
+ int events = desc.second.Events;
+
+ if (desc.second.EventInterface) {
desc.second.EventInterface->m_EnginePrivate = &pfds[i];
+ if (!desc.second.EventInterface->m_Events)
+ events = 0;
+ }
+
pfds[i].fd = desc.first;
- pfds[i].events = desc.second.Events;
+ pfds[i].events = events;
descriptors[i] = desc.second;
i++;
*/
ERR_clear_error();
+ size_t readTotal = 0;
+
switch (m_CurrentAction) {
case TlsActionRead:
do {
if (rc > 0) {
m_RecvQ->Write(buffer, rc);
success = true;
+
+ readTotal += rc;
}
- } while (rc > 0);
+ } while (rc > 0 && readTotal < 64 * 1024);
if (success)
m_CV.notify_all();
lock.unlock();
- while (m_RecvQ->IsDataAvailable() && IsHandlingEvents())
+ while (!IsCorked() && m_RecvQ->IsDataAvailable() && IsHandlingEvents())
SignalDataAvailable();
}
return res;
}
- m_Stream->SetCorked(true);
-
- m_RequestQueue.Enqueue(std::bind(&HttpServerConnection::ProcessMessageAsync,
+ m_RequestQueue.Enqueue(boost::bind(&HttpServerConnection::ProcessMessageAsync,
HttpServerConnection::Ptr(this), m_CurrentRequest, response, m_AuthenticatedUser));
m_Seen = Utility::GetTime();
if (!m_Stream->IsEof()) {
boost::mutex::scoped_lock lock(m_DataHandlerMutex);
+ m_Stream->SetCorked(true);
+
try {
while (ProcessMessage())
; /* empty loop body */
close = true;
}
+
+ m_RequestQueue.Enqueue(boost::bind(&Stream::SetCorked, m_Stream, false));
} else
close = true;
try {
MessageHandler(jsonString);
-
- m_Stream->SetCorked(false);
} catch (const std::exception& ex) {
Log(LogWarning, "JsonRpcConnection")
<< "Error while reading JSON-RPC message for identity '" << m_Identity
if (srs != StatusNewItem)
return false;
- m_Stream->SetCorked(true);
-
l_JsonRpcConnectionWorkQueues[m_ID % l_JsonRpcConnectionWorkQueueCount].Enqueue(boost::bind(&JsonRpcConnection::MessageHandlerWrapper, JsonRpcConnection::Ptr(this), message));
return true;
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(boost::bind(&Stream::SetCorked, m_Stream, false));
} else
close = true;