Skip to content
Snippets Groups Projects
Commit 68c39bd6 authored by Steven Murray's avatar Steven Murray
Browse files

cta/CTA#139 cta af ls --vid XXXXX command times out if there are many files on a tape

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';
  }
parent 7d13079e
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment