GNUTLS: Shut down sessions properly
If gnutls_bye() fails with a fatal error, we would reattempt it again and again, even though this may then go on to e.g. cause a segmentation fault. Now we just keep retrying if it was interrupted, in line with the other backends, up to a maximum of 3 retries.
This commit is contained in:
parent
a3a25a4c8a
commit
4d89c83c32
1 changed files with 9 additions and 4 deletions
|
@ -58,18 +58,23 @@ static int cert_callback(gnutls_session_t session, const gnutls_datum_t *req_ca_
|
||||||
#define SSL_P(x) *((gnutls_session_t *)F->ssl)
|
#define SSL_P(x) *((gnutls_session_t *)F->ssl)
|
||||||
|
|
||||||
void
|
void
|
||||||
rb_ssl_shutdown(rb_fde_t *F)
|
rb_ssl_shutdown(rb_fde_t *const F)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
if(F == NULL || F->ssl == NULL)
|
if(F == NULL || F->ssl == NULL)
|
||||||
return;
|
return;
|
||||||
for(i = 0; i < 4; i++)
|
|
||||||
|
for(int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if(gnutls_bye(SSL_P(F), GNUTLS_SHUT_RDWR) == GNUTLS_E_SUCCESS)
|
int ret = gnutls_bye(SSL_P(F), GNUTLS_SHUT_RDWR);
|
||||||
|
|
||||||
|
if(ret != GNUTLS_E_INTERRUPTED && ret != GNUTLS_E_AGAIN)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gnutls_deinit(SSL_P(F));
|
gnutls_deinit(SSL_P(F));
|
||||||
|
|
||||||
rb_free(F->ssl);
|
rb_free(F->ssl);
|
||||||
|
F->ssl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
|
|
Loading…
Reference in a new issue