~ubuntu-branches/ubuntu/precise/nordugrid-arc/precise

« back to all changes in this revision

Viewing changes to src/hed/dmc/gridftp/DataPointGridFTP.cpp

  • Committer: Package Import Robot
  • Author(s): Mattias Ellert
  • Date: 2012-03-01 19:48:16 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20120301194816-m1ezrwnwt2qgnc2e
Tags: 1.1.1-1
* 1.1.1 Bugfix Release
* Fixes FTBFS (Closes: #661774) (LP: #935007)
* Fix typo in package description (Closes: #646979)
* Split binary rule in debian/rules for arch and indep

Show diffs side-by-side

added added

removed removed

Lines of Context:
625
625
      std::string csum(buf);
626
626
      if (csum.substr(0, csum.find(':')) == DefaultCheckSum()) {
627
627
        logger.msg(VERBOSE, "StopWriting: Calculated checksum %s", csum);
628
 
        // list checksum and compare
629
 
        // note: not all implementations support checksum
630
 
        logger.msg(DEBUG, "list_files_ftp: "
631
 
                          "looking for checksum of %s", url.str());
632
 
        char cksum[256];
633
 
        std::string cksumtype(upper(DefaultCheckSum()));
634
 
        GlobusResult res = globus_ftp_client_cksm(&ftp_handle, url.str().c_str(),
635
 
                                                  &ftp_opattr, cksum, (globus_off_t)0,
636
 
                                                  (globus_off_t)-1, cksumtype.c_str(),
637
 
                                                  &ftp_complete_callback, cbarg);
638
 
        if (!res) {
639
 
          logger.msg(VERBOSE, "list_files_ftp: globus_ftp_client_cksum failed");
640
 
          logger.msg(VERBOSE, "Globus error: %s", res.str());
641
 
        }
642
 
        else if (!cond.wait(1000*usercfg.Timeout())) {
643
 
          logger.msg(VERBOSE, "list_files_ftp: timeout waiting for cksum");
644
 
          globus_ftp_client_abort(&ftp_handle);
645
 
          cond.wait();
646
 
        }
647
 
        else if (!callback_status) {
648
 
          // reset to success since failing to get checksum should not trigger an error
649
 
          callback_status = DataStatus::Success;
650
 
          logger.msg(INFO, "list_files_ftp: failed to get file's checksum");
651
 
        }
652
 
        else {
653
 
          logger.msg(VERBOSE, "list_files_ftp: checksum %s", cksum);
654
 
          if (csum.substr(csum.find(':')+1) == std::string(cksum)) {
655
 
            logger.msg(INFO, "Calculated checksum %s matches checksum reported by server", csum);
656
 
            SetCheckSum(csum);
657
 
          } else {
658
 
            logger.msg(ERROR, "Checksum mismatch between calculated checksum %s and checksum reported by server %s",
659
 
                       csum, std::string(DefaultCheckSum()+':'+cksum));
660
 
            return DataStatus::TransferErrorRetryable;
 
628
        if(additional_checks) {
 
629
          // list checksum and compare
 
630
          // note: not all implementations support checksum
 
631
          logger.msg(DEBUG, "list_files_ftp: "
 
632
                            "looking for checksum of %s", url.str());
 
633
          char cksum[256];
 
634
          std::string cksumtype(upper(DefaultCheckSum()));
 
635
          GlobusResult res = globus_ftp_client_cksm(&ftp_handle, url.str().c_str(),
 
636
                                                    &ftp_opattr, cksum, (globus_off_t)0,
 
637
                                                    (globus_off_t)-1, cksumtype.c_str(),
 
638
                                                    &ftp_complete_callback, cbarg);
 
639
          if (!res) {
 
640
            logger.msg(VERBOSE, "list_files_ftp: globus_ftp_client_cksum failed");
 
641
            logger.msg(VERBOSE, "Globus error: %s", res.str());
 
642
          }
 
643
          else if (!cond.wait(1000*usercfg.Timeout())) {
 
644
            logger.msg(VERBOSE, "list_files_ftp: timeout waiting for cksum");
 
645
            globus_ftp_client_abort(&ftp_handle);
 
646
            cond.wait();
 
647
          }
 
648
          else if (!callback_status) {
 
649
            // reset to success since failing to get checksum should not trigger an error
 
650
            callback_status = DataStatus::Success;
 
651
            logger.msg(INFO, "list_files_ftp: no checksum information possible");
 
652
          }
 
653
          else {
 
654
            logger.msg(VERBOSE, "list_files_ftp: checksum %s", cksum);
 
655
            if (csum.substr(csum.find(':')+1) == std::string(cksum)) {
 
656
              logger.msg(INFO, "Calculated checksum %s matches checksum reported by server", csum);
 
657
              SetCheckSum(csum);
 
658
            } else {
 
659
              logger.msg(ERROR, "Checksum mismatch between calculated checksum %s and checksum reported by server %s",
 
660
                         csum, std::string(DefaultCheckSum()+':'+cksum));
 
661
              return DataStatus::TransferErrorRetryable;
 
662
            }
661
663
          }
662
664
        }
663
665
      }
865
867
                                   (globus_off_t)-1, cksumtype.c_str(),
866
868
                                   &ftp_complete_callback, cbarg);
867
869
      if (!res) {
868
 
        logger.msg(VERBOSE, "list_files_ftp: globus_ftp_client_cksum failed");
 
870
        logger.msg(VERBOSE, "list_files_ftp: globus_ftp_client_cksm failed");
869
871
        logger.msg(VERBOSE, "Globus error: %s", res.str());
870
872
      }
871
873
      else if (!cond.wait(1000*usercfg.Timeout())) {
874
876
        cond.wait();
875
877
      }
876
878
      else if (!callback_status) {
877
 
        logger.msg(INFO, "list_files_ftp: failed to get file's checksum");
 
879
        // reset to success since failing to get checksum should not trigger an error
 
880
        callback_status = DataStatus::Success;
 
881
        logger.msg(INFO, "list_files_ftp: no checksum information possible");
878
882
      }
879
883
      else {
880
884
        logger.msg(VERBOSE, "list_files_ftp: checksum %s", cksum);