Skip to content

Commit

Permalink
[XrdEc] Don't close ZipArchive obj that were not opened.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jan 20, 2021
1 parent 36f527b commit b9f6397
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/XrdEc/XrdEcReader.cc
Expand Up @@ -531,9 +531,9 @@ namespace XrdEc
auto itr = dataarchs.begin();
for( ; itr != dataarchs.end() ; ++itr )
{
XrdCl::ZipArchive &zip = *itr->second;
if( zip.IsOpen() )
closes.emplace_back( XrdCl::CloseArchive( zip ) );
auto &zipptr = itr->second;
if( zipptr->IsOpen() )
closes.emplace_back( XrdCl::CloseArchive( *zipptr ) >> [zipptr]( XrdCl::XRootDStatus& ){ } );
}

// if there is nothing to close just schedule the handler
Expand Down
32 changes: 25 additions & 7 deletions src/XrdEc/XrdEcStrmWriter.cc
@@ -1,9 +1,26 @@
/*
* XrdEcStrmWriter.cc
*
* Created on: 5 May 2020
* Author: simonm
*/
//------------------------------------------------------------------------------
// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
// Author: Michal Simon <michal.simon@cern.ch>
//------------------------------------------------------------------------------
// This file is part of the XRootD software suite.
//
// XRootD is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// XRootD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//
// In applying this licence, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//------------------------------------------------------------------------------

#include "XrdEc/XrdEcStrmWriter.hh"
#include "XrdEc/XrdEcThreadPool.hh"
Expand Down Expand Up @@ -275,7 +292,8 @@ namespace XrdEc
//-----------------------------------------------------------------------
// close ZIP archives with data
//-----------------------------------------------------------------------
closes.emplace_back( XrdCl::CloseArchive( *dataarchs[i] ) );
if( dataarchs[i]->IsOpen() )
closes.emplace_back( XrdCl::CloseArchive( *dataarchs[i] ) );
//-----------------------------------------------------------------------
// replicate the metadata
//-----------------------------------------------------------------------
Expand Down
29 changes: 23 additions & 6 deletions src/XrdEc/XrdEcStrmWriter.hh
@@ -1,9 +1,26 @@
/*
* XrdEcStrmWriter.hh
*
* Created on: 5 May 2020
* Author: simonm
*/
//------------------------------------------------------------------------------
// Copyright (c) 2011-2014 by European Organization for Nuclear Research (CERN)
// Author: Michal Simon <michal.simon@cern.ch>
//------------------------------------------------------------------------------
// This file is part of the XRootD software suite.
//
// XRootD is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// XRootD is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
//
// In applying this licence, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
//------------------------------------------------------------------------------

#ifndef SRC_XRDEC_XRDECSTRMWRITER_HH_
#define SRC_XRDEC_XRDECSTRMWRITER_HH_
Expand Down

0 comments on commit b9f6397

Please sign in to comment.