mirror of
https://github.com/aria2/aria2.git
synced 2025-01-08 11:01:38 +00:00
gnutls: Don't fail handshake if returned error is not fatal
This commit is contained in:
parent
3c789294b7
commit
e81dd84641
@ -181,11 +181,15 @@ int GnuTLSSession::tlsConnect(const std::string& hostname,
|
||||
std::string& handshakeErr)
|
||||
{
|
||||
handshakeErr = "";
|
||||
rv_ = gnutls_handshake(sslSession_);
|
||||
if(rv_ < 0) {
|
||||
for(;;) {
|
||||
rv_ = gnutls_handshake(sslSession_);
|
||||
if(rv_ == GNUTLS_E_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) {
|
||||
return TLS_ERR_WOULDBLOCK;
|
||||
} else {
|
||||
}
|
||||
if(gnutls_error_is_fatal(rv_)) {
|
||||
return TLS_ERR_ERROR;
|
||||
}
|
||||
}
|
||||
@ -279,13 +283,17 @@ int GnuTLSSession::tlsConnect(const std::string& hostname,
|
||||
|
||||
int GnuTLSSession::tlsAccept()
|
||||
{
|
||||
rv_ = gnutls_handshake(sslSession_);
|
||||
if(rv_ == GNUTLS_E_SUCCESS) {
|
||||
return TLS_ERR_OK;
|
||||
} else if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) {
|
||||
return TLS_ERR_WOULDBLOCK;
|
||||
} else {
|
||||
return TLS_ERR_ERROR;
|
||||
for(;;) {
|
||||
rv_ = gnutls_handshake(sslSession_);
|
||||
if(rv_ == GNUTLS_E_SUCCESS) {
|
||||
return TLS_ERR_OK;
|
||||
}
|
||||
if(rv_ == GNUTLS_E_AGAIN || rv_ == GNUTLS_E_INTERRUPTED) {
|
||||
return TLS_ERR_WOULDBLOCK;
|
||||
}
|
||||
if(gnutls_error_is_fatal(rv_)) {
|
||||
return TLS_ERR_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user