OpenSSL: Tweak connection shutdown logic

This commit is contained in:
Aaron Jones 2016-09-15 19:14:41 +00:00
parent 485b5b8084
commit bd8097c459
No known key found for this signature in database
GPG key ID: EC6F86EE9CD840B5

View file

@ -259,11 +259,12 @@ rb_ssl_shutdown(rb_fde_t *const F)
(void) rb_ssl_last_err();
SSL_set_shutdown(SSL_P(F), SSL_RECEIVED_SHUTDOWN);
for(int i = 0; i < 4; i++)
{
if(SSL_shutdown(SSL_P(F)))
int ret = SSL_shutdown(SSL_P(F));
int err = SSL_get_error(SSL_P(F), ret);
if(ret >= 0 || (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE))
break;
}