14 #define FAKE_ERROR_COUNTER 5 17 #define FAKE_ERROR_COUNTER 0 26 std::unique_ptr<XrdCl::AnyObject> response(resp);
27 std::unique_ptr<XrdCl::XRootDStatus>
status(stat);
28 std::shared_ptr<ClientRequest> self_ref = self_reference();
29 m_self_reference =
nullptr;
40 XrdCl::ChunkInfo *read_info;
41 response->Get(read_info);
42 if( read_info ==
nullptr) {
44 ex<<
"nullptr returned from response->Get().";
45 ex.
addContext(
"XrdAdaptor::ClientRequest::HandleResponse() called." );
46 m_promise.set_exception( std::make_exception_ptr(ex));
49 if( read_info->length == 0) {
edm::LogWarning(
"XrdAdaptorInternal") <<
"XrdAdaptor::ClientRequest::HandleResponse: While reading from\n " 50 << m_manager.getFilename() <<
"\n received a read_info->length = 0 and read_info->offset = "<<read_info->offset;
52 m_promise.set_value(read_info->length);
56 XrdCl::VectorReadInfo *read_info;
57 response->Get(read_info);
58 if( read_info ==
nullptr) {
60 ex<<
"nullptr returned from response->Get() from vector read.";
61 ex.
addContext(
"XrdAdaptor::ClientRequest::HandleResponse() called." );
62 m_promise.set_exception( std::make_exception_ptr(ex));
65 if( read_info->GetSize() == 0) {
edm::LogWarning(
"XrdAdaptorInternal") <<
"XrdAdaptor::ClientRequest::HandleResponse: While reading from\n " 66 << m_manager.getFilename() <<
"\n received a read_info->GetSize() = 0";
69 m_promise.set_value(read_info->GetSize());
75 edm::LogWarning(
"XrdAdaptorInternal") <<
"XrdRequestManager::handle(name='" 76 << m_manager.getFilename() <<
") failure when reading from " 77 << (source ? source->
PrettyID() :
"(unknown source)")
78 <<
"; failed with error '" << status->ToStr() <<
"' (errno=" 79 << status->errNo <<
", code=" << status->code <<
").";
85 m_manager.requestFailure(self_ref, *status);
90 if (ex.
getCode() == XrdCl::errInvalidResponse)
92 m_promise.set_exception(std::current_exception());
99 ex.
addContext(
"XrdAdaptor::ClientRequest::HandleResponse() failure while running connection recovery");
100 std::stringstream ss;
101 ss <<
"Original error: '" << status->ToStr() <<
"' (errno=" 102 << status->errNo <<
", code=" << status->code <<
", source=" << (source ? source->
PrettyID() :
"(unknown source)") <<
").";
104 m_promise.set_exception(std::current_exception());
105 edm::LogWarning(
"XrdAdaptorInternal") <<
"Caught a CMSSW exception when running connection recovery.";
110 ex <<
"XrdRequestManager::handle(name='" << m_manager.getFilename()
111 <<
") failed with error '" << status->ToStr()
112 <<
"' (errno=" << status->errNo <<
", code=" 113 << status->code <<
"). Unknown exception occurred when running" 114 <<
" connection recovery.";
115 ex.
addContext(
"Calling XrdRequestManager::handle()");
116 m_manager.addConnections(ex);
118 m_promise.set_exception(std::make_exception_ptr(ex));
119 edm::LogWarning(
"XrdAdaptorInternal") <<
"Caught a new exception when running connection recovery.";
const std::string & PrettyID() const
void addAdditionalInfo(std::string const &info)
void addContext(std::string const &context)
void swap(QualityMetricWatch &)
#define FAKE_ERROR_COUNTER
static std::string const source
static std::atomic< int > g_fakeError
virtual void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override