Changed secure connest and accept to match read/write retry logic #4750

This commit is contained in:
Adam Potolsky 2015-06-24 11:11:20 -07:00
parent 6442bcb8f6
commit e50b239592
1 changed files with 19 additions and 15 deletions

View File

@ -429,11 +429,19 @@ SecureSocket::checkResult(int status, int& retry)
break; break;
case SSL_ERROR_WANT_CONNECT: case SSL_ERROR_WANT_CONNECT:
case SSL_ERROR_WANT_ACCEPT: m_writable = true;
m_readable = true;
retry++; retry++;
LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", errorCode, retry)); LOG((CLOG_DEBUG2 "want to connect, error=%d, attempt=%d", errorCode, retry));
break; break;
case SSL_ERROR_WANT_ACCEPT:
m_writable = true;
m_readable = true;
retry++;
LOG((CLOG_DEBUG2 "want to accept, error=%d, attempt=%d", errorCode, retry));
break;
case SSL_ERROR_SYSCALL: case SSL_ERROR_SYSCALL:
LOG((CLOG_ERR "ssl error occurred (system call failure)")); LOG((CLOG_ERR "ssl error occurred (system call failure)"));
if (ERR_peek_error() == 0) { if (ERR_peek_error() == 0) {
@ -595,16 +603,14 @@ SecureSocket::serviceConnect(ISocketMultiplexerJob* job,
status = secureConnect(getSocket()->m_fd); status = secureConnect(getSocket()->m_fd);
#endif #endif
if (status > 0) {
return newJob();
}
else if (status == 0) {
return job;
}
// If status < 0, error happened // If status < 0, error happened
if (status < 0) {
return NULL; return NULL;
} }
return newJob();
}
ISocketMultiplexerJob* ISocketMultiplexerJob*
SecureSocket::serviceAccept(ISocketMultiplexerJob* job, SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
bool, bool write, bool error) bool, bool write, bool error)
@ -618,16 +624,14 @@ SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
status = secureAccept(getSocket()->m_fd); status = secureAccept(getSocket()->m_fd);
#endif #endif
if (status > 0) {
return newJob();
}
else if (status == 0) {
return job;
}
// If status < 0, error happened // If status < 0, error happened
if (status < 0) {
return NULL; return NULL;
} }
return newJob();
}
void void
showCipherStackDesc(STACK_OF(SSL_CIPHER) * stack) { showCipherStackDesc(STACK_OF(SSL_CIPHER) * stack) {
char msg[kMsgSize]; char msg[kMsgSize];