Skip to content

Commit

Permalink
[XrdCl] Handle properly seerver disconnect.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Nov 9, 2018
1 parent c49e9ca commit 2ab600c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/XrdCl/XrdClXRootDTransport.cc
Expand Up @@ -227,7 +227,13 @@ namespace XrdCl
while( leftToBeRead )
{
int status = ::read( socket, message->GetBufferAtCursor(), leftToBeRead );
if( status <= 0 )

// if the server shut down the socket declare a socket error (it
// will trigger a re-connect)
if( status == 0 )
return Status( stError, errSocketError, errno );

if( status < 0 )
return ClassifyErrno( errno );

leftToBeRead -= status;
Expand Down Expand Up @@ -263,7 +269,13 @@ namespace XrdCl
while( leftToBeRead )
{
int status = ::read( socket, message->GetBufferAtCursor(), leftToBeRead );
if( status <= 0 )

// if the server shut down the socket declare a socket error (it
// will trigger a re-connect)
if( status == 0 )
return Status( stError, errSocketError, errno );

if( status < 0 )
return ClassifyErrno( errno );

leftToBeRead -= status;
Expand Down

0 comments on commit 2ab600c

Please sign in to comment.