Skip to content

Commit

Permalink
[XrdCl] Iron out final details for checksum type inference.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Apr 7, 2020
1 parent b0f68e2 commit eccc2de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/XrdCl/XrdClClassicCopyJob.cc
Expand Up @@ -1585,7 +1585,10 @@ namespace XrdCl
{
checkSumType = Utils::InferChecksumType( GetSource(), GetTarget(), zip );
if( checkSumType.empty() )
log->Info( UtilityMsg, "Could not infer checksum type." );
{
log->Warning( UtilityMsg, "Could not infer checksum type." );
checkSumMode = "";
}
else
log->Info( UtilityMsg, "Using inferred checksum type: %s.", checkSumType.c_str() );
}
Expand Down
14 changes: 10 additions & 4 deletions src/XrdCl/XrdClUtils.cc
Expand Up @@ -34,6 +34,7 @@
#include <map>
#include <string>
#include <set>
#include <cctype>

#include <sys/types.h>
#include <dirent.h>
Expand Down Expand Up @@ -623,7 +624,11 @@ namespace XrdCl
{
size_t pos = itr->find( ':' );
if( pos == std::string::npos ) continue;
ret.push_back( itr->substr( pos + 1 ) );
std::string cksname = itr->substr( pos + 1 );
// remove all white spaces
cksname.erase( std::remove_if( cksname.begin(), cksname.end(), ::isspace ),
cksname.end() );
ret.push_back( std::move( cksname ) );
}
}
}
Expand All @@ -642,13 +647,14 @@ namespace XrdCl
//--------------------------------------------------------------------------
// If both files are local we wont be checksumming at all
//--------------------------------------------------------------------------
if( source.IsLocalFile() && destination.IsLocalFile() ) return std::string();
if( source.IsLocalFile() && !source.IsMetalink() && destination.IsLocalFile() ) return std::string();

// checksums supported by local files
std::set<std::string> local_supported;
local_supported.insert( "adler32" );
local_supported.insert( "crc32" );
local_supported.insert( "md5" );
local_supported.insert( "zcrc32" );

std::vector<std::string> srccks;

Expand Down Expand Up @@ -696,7 +702,7 @@ namespace XrdCl
// If the destination is a remote endpoint query the supported checksums
//------------------------------------------------------------------------
std::vector<std::string> cks = GetSupportedCheckSums( destination );
srccks.insert( dstcks.end(), cks.begin(), cks.end() );
dstcks.insert( dstcks.end(), cks.begin(), cks.end() );
}

//--------------------------------------------------------------------------
Expand All @@ -705,7 +711,7 @@ namespace XrdCl
//
// First check if source is local
//--------------------------------------------------------------------------
if( source.IsLocalFile() )
if( source.IsLocalFile() && !source.IsMetalink() )
{
std::vector<std::string>::iterator itr = dstcks.begin();
for( ; itr != dstcks.end(); ++itr )
Expand Down

0 comments on commit eccc2de

Please sign in to comment.