char buffer[512];
if (m_CurrentAction == TlsActionNone) {
- if (m_SendQ->GetAvailableBytes() > 0 && (revents & POLLOUT))
- m_CurrentAction = TlsActionWrite;
- else
+ if (revents & POLLIN)
m_CurrentAction = TlsActionRead;
+ else if (m_SendQ->GetAvailableBytes() > 0 && (revents & POLLOUT))
+ m_CurrentAction = TlsActionWrite;
+ else {
+ ChangeEvents(POLLIN);
+ return;
+ }
}
switch (m_CurrentAction) {
}
if (rc > 0) {
- if (m_SendQ->GetAvailableBytes() > 0) {
- m_CurrentAction = TlsActionWrite;
+ m_CurrentAction = TlsActionNone;
+
+ if (m_SendQ->GetAvailableBytes() > 0)
ChangeEvents(POLLIN|POLLOUT);
- } else {
- m_CurrentAction = TlsActionNone;
+ else
ChangeEvents(POLLIN);
- }
lock.unlock();
break;
case SSL_ERROR_WANT_WRITE:
m_Retry = true;
- ChangeEvents(POLLIN|POLLOUT);
+ ChangeEvents(POLLOUT);
break;
case SSL_ERROR_ZERO_RETURN: