Skip to content

Commit

Permalink
[XrdCl] Correctly propagate TLS error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jan 11, 2021
1 parent 26d13ab commit a7c1fca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/XrdCl/XrdClPostMasterInterfaces.hh
Expand Up @@ -351,7 +351,7 @@ namespace XrdCl
//! stOK & suRetry if more data is needed
//! stError on failure
//------------------------------------------------------------------------
virtual Status GetHeader( Message *message, Socket *socket ) = 0;
virtual XRootDStatus GetHeader( Message *message, Socket *socket ) = 0;

//------------------------------------------------------------------------
//! Read the message body from the socket, the socket is non-blocking,
Expand All @@ -363,7 +363,7 @@ namespace XrdCl
//! stOK & suRetry if more data is needed
//! stError on failure
//------------------------------------------------------------------------
virtual Status GetBody( Message *message, Socket *socket ) = 0;
virtual XRootDStatus GetBody( Message *message, Socket *socket ) = 0;

//------------------------------------------------------------------------
//! Initialize channel
Expand Down
6 changes: 3 additions & 3 deletions src/XrdCl/XrdClTls.cc
Expand Up @@ -320,14 +320,14 @@ namespace XrdCl
case XrdTls::TLS_WantRead: return XRootDStatus( stOK, suRetry, 0, msg );

case XrdTls::TLS_UNK_Error:
case XrdTls::TLS_SYS_Error: return XRootDStatus( stError, errTlsError, errno, msg );
case XrdTls::TLS_SYS_Error: return XRootDStatus( stError, errTlsError, 0, msg );

case XrdTls::TLS_VER_Error:
case XrdTls::TLS_SSL_Error:
case XrdTls::TLS_HNV_Error: return XRootDStatus( stFatal, errTlsError, errno, msg );
case XrdTls::TLS_HNV_Error: return XRootDStatus( stFatal, errTlsError, 0, msg );

default:
return XRootDStatus( stError, errTlsError, rc, msg );
return XRootDStatus( stError, errTlsError, 0, msg );
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/XrdCl/XrdClXRootDTransport.cc
Expand Up @@ -281,7 +281,7 @@ namespace XrdCl
//----------------------------------------------------------------------------
// Read message header from socket
//----------------------------------------------------------------------------
Status XRootDTransport::GetHeader( Message *message, Socket *socket )
XRootDStatus XRootDTransport::GetHeader( Message *message, Socket *socket )
{
//--------------------------------------------------------------------------
// A new message - allocate the space needed for the header
Expand All @@ -298,7 +298,7 @@ namespace XrdCl
while( leftToBeRead )
{
int bytesRead = 0;
Status status = socket->Read( message->GetBufferAtCursor(), leftToBeRead, bytesRead );
XRootDStatus status = socket->Read( message->GetBufferAtCursor(), leftToBeRead, bytesRead );

if( !status.IsOK() || status.code == suRetry )
return status;
Expand All @@ -313,15 +313,15 @@ namespace XrdCl
log->Dump( XRootDTransportMsg, "[msg: 0x%x] Expecting %d bytes of message "
"body", message, bodySize );

return Status( stOK, suDone );
return XRootDStatus( stOK, suDone );
}
return Status( stError, errInternal );
return XRootDStatus( stError, errInternal );
}

//----------------------------------------------------------------------------
// Read message body from socket
//----------------------------------------------------------------------------
Status XRootDTransport::GetBody( Message *message, Socket *socket )
XRootDStatus XRootDTransport::GetBody( Message *message, Socket *socket )
{
//--------------------------------------------------------------------------
// Retrieve the body
Expand Down Expand Up @@ -351,15 +351,15 @@ namespace XrdCl
while( leftToBeRead )
{
int bytesRead = 0;
Status status = socket->Read( message->GetBufferAtCursor(), leftToBeRead, bytesRead );
XRootDStatus status = socket->Read( message->GetBufferAtCursor(), leftToBeRead, bytesRead );

if( !status.IsOK() || status.code == suRetry )
return status;

leftToBeRead -= bytesRead;
message->AdvanceCursor( bytesRead );
}
return Status( stOK, suDone );
return XRootDStatus( stOK, suDone );
}

//----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/XrdCl/XrdClXRootDTransport.hh
Expand Up @@ -78,7 +78,7 @@ namespace XrdCl
//! stOK & suRetry if more data is needed
//! stError on failure
//------------------------------------------------------------------------
virtual Status GetHeader( Message *message, Socket *socket );
virtual XRootDStatus GetHeader( Message *message, Socket *socket );

//------------------------------------------------------------------------
//! Read the message body from the socket, the socket is non-blocking,
Expand All @@ -90,7 +90,7 @@ namespace XrdCl
//! stOK & suRetry if more data is needed
//! stError on failure
//------------------------------------------------------------------------
virtual Status GetBody( Message *message, Socket *socket );
virtual XRootDStatus GetBody( Message *message, Socket *socket );

//------------------------------------------------------------------------
//! Initialize channel
Expand Down

0 comments on commit a7c1fca

Please sign in to comment.