Skip to content

Commit

Permalink
Merge pull request #7063 from bbockelm/check_open_status
Browse files Browse the repository at this point in the history
Check immediate return status from XrdClFile::Open call.
  • Loading branch information
davidlange6 committed Jan 7, 2015
2 parents defb152 + 06fd6b2 commit 6186f3b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Utilities/XrdAdaptor/src/XrdHostHandler.hh
Expand Up @@ -39,7 +39,7 @@ public:

virtual void HandleResponseWithHosts(XrdCl::XRootDStatus *status,
XrdCl::AnyObject *response,
XrdCl::HostList *hostList)
XrdCl::HostList *hostList) override
{
pStatus.reset(status);
pResponse.reset(response);
Expand Down
19 changes: 18 additions & 1 deletion Utilities/XrdAdaptor/src/XrdRequestManager.cc
Expand Up @@ -139,7 +139,24 @@ RequestManager::initialize(std::weak_ptr<RequestManager> self)
auto opaque = prepareOpaqueString();
std::string new_filename = m_name + (opaque.size() ? ((m_name.find("?") == m_name.npos) ? "?" : "&") + opaque : "");
SyncHostResponseHandler handler;
file->Open(new_filename, m_flags, m_perms, &handler);
XrdCl::XRootDStatus openStatus = file->Open(new_filename, m_flags, m_perms, &handler);
if (!openStatus.IsOK())
{ // In this case, we failed immediately - this indicates we have previously tried to talk to this
// server and it was marked bad - xrootd couldn't even queue up the request internally!
// In practice, we obsere this happening when the call to getXrootdSiteFromURL fails due to the
// redirector being down or authentication failures.
ex.clearMessage();
ex.clearContext();
ex.clearAdditionalInfo();
ex << "XrdCl::File::Open(name='" << m_name
<< "', flags=0x" << std::hex << m_flags
<< ", permissions=0" << std::oct << m_perms << std::dec
<< ") => error '" << openStatus.ToStr()
<< "' (errno=" << openStatus.errNo << ", code=" << openStatus.code << ")";
ex.addContext("Calling XrdFile::open()");
ex.addAdditionalInfo("Remote server already encountered a fatal error; no redirections were performed.");
throw ex;
}
handler.WaitForResponse();
std::unique_ptr<XrdCl::XRootDStatus> status = handler.GetStatus();
std::unique_ptr<XrdCl::HostList> hostList = handler.GetHosts();
Expand Down

0 comments on commit 6186f3b

Please sign in to comment.