Merge branch 'master' of github.com:debauchee/barrier

This commit is contained in:
walker0643 2018-02-01 18:42:41 -05:00
commit 1effd7bc0b
1 changed files with 8 additions and 1 deletions

View File

@ -77,6 +77,10 @@ SecureSocket::SecureSocket(
SecureSocket::~SecureSocket() SecureSocket::~SecureSocket()
{ {
isFatal(true); isFatal(true);
// take socket from multiplexer ASAP otherwise the race condition
// could cause events to get called on a dead object. TCPSocket
// will do this, too, but the double-call is harmless
setJob(NULL);
if (m_ssl->m_ssl != NULL) { if (m_ssl->m_ssl != NULL) {
SSL_shutdown(m_ssl->m_ssl); SSL_shutdown(m_ssl->m_ssl);
@ -87,7 +91,9 @@ SecureSocket::~SecureSocket()
SSL_CTX_free(m_ssl->m_context); SSL_CTX_free(m_ssl->m_context);
m_ssl->m_context = NULL; m_ssl->m_context = NULL;
} }
ARCH->sleep(1); // removing sleep() because I have no idea why you would want to do it
// ... smells of trying to cover up a bug you don't understand
//ARCH->sleep(1);
delete m_ssl; delete m_ssl;
} }
@ -403,6 +409,7 @@ SecureSocket::createSSL()
// I assume just one instance is needed // I assume just one instance is needed
// get new SSL state with context // get new SSL state with context
if (m_ssl->m_ssl == NULL) { if (m_ssl->m_ssl == NULL) {
assert(m_ssl->m_context != NULL);
m_ssl->m_ssl = SSL_new(m_ssl->m_context); m_ssl->m_ssl = SSL_new(m_ssl->m_context);
} }
} }