retry case needs to do another job with the same parameters not just a new job #4750

This commit is contained in:
Adam Potolsky 2015-06-24 16:31:47 -07:00
parent 2df88e07c4
commit f10f0f13c4
1 changed files with 20 additions and 5 deletions

View File

@ -439,7 +439,7 @@ SecureSocket::checkResult(int status, int& retry)
break; break;
case SSL_ERROR_WANT_ACCEPT: case SSL_ERROR_WANT_ACCEPT:
m_writable = true; m_writable = true;
m_readable = true; m_readable = true;
retry++; retry++;
LOG((CLOG_DEBUG2 "want to accept, error=%d, attempt=%d", errorCode, retry)); LOG((CLOG_DEBUG2 "want to accept, error=%d, attempt=%d", errorCode, retry));
@ -611,7 +611,15 @@ SecureSocket::serviceConnect(ISocketMultiplexerJob* job,
return NULL; return NULL;
} }
return newJob(); // If status > 0, success
if (status > 0) {
return newJob();
}
// Retry case
return new TSocketMultiplexerMethodJob<SecureSocket>(
this, &SecureSocket::serviceConnect,
getSocket(), isReadable(), isWritable());
} }
ISocketMultiplexerJob* ISocketMultiplexerJob*
@ -626,13 +634,20 @@ SecureSocket::serviceAccept(ISocketMultiplexerJob* job,
#elif SYSAPI_UNIX #elif SYSAPI_UNIX
status = secureAccept(getSocket()->m_fd); status = secureAccept(getSocket()->m_fd);
#endif #endif
LOG((CLOG_ERR "DELME: status:%d",status)); // If status < 0, error happened
// If status < 0, error happened
if (status < 0) { if (status < 0) {
return NULL; return NULL;
} }
return newJob(); // If status > 0, success
if (status > 0) {
return newJob();
}
// Retry case
return new TSocketMultiplexerMethodJob<SecureSocket>(
this, &SecureSocket::serviceConnect,
getSocket(), isReadable(), isWritable());
} }
void void