Fix another potential problem where TLS connection might get stalled

refs #8485
This commit is contained in:
Gunnar Beutner 2015-02-24 07:11:22 +01:00
parent 55c974b0f4
commit 2922d5d9bd
1 changed files with 4 additions and 4 deletions

View File

@ -128,7 +128,7 @@ void TlsStream::OnEvent(int revents)
char buffer[512]; char buffer[512];
if (m_CurrentAction == TlsActionNone) { if (m_CurrentAction == TlsActionNone) {
if (m_SendQ->GetAvailableBytes() > 0) if (m_SendQ->GetAvailableBytes() > 0 && (revents & POLLOUT))
m_CurrentAction = TlsActionWrite; m_CurrentAction = TlsActionWrite;
else else
m_CurrentAction = TlsActionRead; m_CurrentAction = TlsActionRead;
@ -179,7 +179,7 @@ void TlsStream::OnEvent(int revents)
if (rc > 0) { if (rc > 0) {
if (m_SendQ->GetAvailableBytes() > 0) { if (m_SendQ->GetAvailableBytes() > 0) {
m_CurrentAction = TlsActionWrite; m_CurrentAction = TlsActionWrite;
ChangeEvents(POLLOUT); ChangeEvents(POLLIN|POLLOUT);
} else { } else {
m_CurrentAction = TlsActionNone; m_CurrentAction = TlsActionNone;
ChangeEvents(POLLIN); ChangeEvents(POLLIN);
@ -205,7 +205,7 @@ void TlsStream::OnEvent(int revents)
break; break;
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
m_Retry = true; m_Retry = true;
ChangeEvents(POLLOUT); ChangeEvents(POLLIN|POLLOUT);
break; break;
case SSL_ERROR_ZERO_RETURN: case SSL_ERROR_ZERO_RETURN:
@ -278,7 +278,7 @@ void TlsStream::Write(const void *buffer, size_t count)
m_SendQ->Write(buffer, count); m_SendQ->Write(buffer, count);
ChangeEvents(POLLOUT); ChangeEvents(POLLIN|POLLOUT);
} }
/** /**