Skip to content

Commit

Permalink
[XrdCl/XrdTls] Retry if SSL_read/write yield SSL_ERROR_NONE.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Oct 16, 2019
1 parent d5158dc commit 7e38183
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/XrdCl/XrdClTls.cc
Expand Up @@ -129,6 +129,12 @@ namespace XrdCl
}
pTlsHSRevert = None;

//------------------------------------------------------------------------
// If we didn't manage to read any data wait for another read event
//------------------------------------------------------------------------
if( bytesRead == 0 )
return Status( stOK, suRetry );

return status;
}

Expand Down Expand Up @@ -185,6 +191,15 @@ namespace XrdCl
}
pTlsHSRevert = None;

//------------------------------------------------------------------------
// If we didn't manage to read any data wait for another write event
//
// Adding this by symmetry, never actually experienced this (for reads
// it has been experienced)
//------------------------------------------------------------------------
if( bytesWritten == 0 )
return Status( stOK, suRetry );

return status;
}

Expand Down
2 changes: 2 additions & 0 deletions src/XrdTls/XrdTlsSocket.cc
Expand Up @@ -467,6 +467,7 @@ XrdTls::RC XrdTlsSocket::Read( char *buffer, size_t size, int &bytesRead )
// not the handshake actually is finished (semi-accurate)
//
error = Diagnose(SSL_get_error( pImpl->ssl, rc ));
if( error == XrdTls::RC::TLS_AOK ) bytesRead = 0;
pImpl->hsDone = bool( SSL_is_init_finished( pImpl->ssl ) );

// The connection creator may wish that we wait for the handshake to
Expand Down Expand Up @@ -565,6 +566,7 @@ XrdTls::RC XrdTlsSocket::Write( const char *buffer, size_t size,
// not the handshake actually is finished (semi-accurate)
//
pImpl->hsDone = bool( SSL_is_init_finished( pImpl->ssl ) );
if( error == XrdTls::RC::TLS_AOK ) bytesWritten = 0;
error = Diagnose(SSL_get_error( pImpl->ssl, rc ));

// The connection creator may wish that we wait for the handshake to
Expand Down

0 comments on commit 7e38183

Please sign in to comment.