Skip to content
  • Steven Murray's avatar
    cta/CTA#139 cta af ls --vid XXXXX command times out if there are many files on a tape · 461b762b
    Steven Murray authored
    Put back the serialising of the command return code.  This was
    once done within the XrdCtaFile::getMmap() method.  It is now
    done within the XrdCtaFile::logRequestAndSetCmdlineResult()
    method.
    
    Please note that command return codes must be in the range "0"
    to "9" because the first ASCII character sent back from the
    CTA front-end to the cta command-line tool is the return code.
    The following code snippet from the implementation of the cta
    command-line tool shows the format of the reply from the CTA
    front-end to the cta command-line tool:
    
      // The cta frontend return code is the first char of the answer
      {
        uint64_t readOffset = 0;
        uint32_t bytesRead = 0;
        char rc_char = '0';
        const XrdCl::XRootDStatus readStatus = xrootFile.Read(readOffset, 1, &rc_char, bytesRead);
        if(!readStatus.IsOK()) {
          throw std::runtime_error(std::string("Failed to read first byte from ") + cmdPath + ": " +
            readStatus.ToStr());
        }
        if(bytesRead != 1) {
          throw std::runtime_error(std::string("Failed to read first byte from ") + cmdPath +
            ": Expected to read exactly 1 byte, actually read " +
            std::to_string((long long unsigned int)bytesRead) + " bytes");
        }
        rc = rc_char - '0';
      }
    461b762b