10 using namespace XrdAdaptor;
14 #define FAKE_ERROR_COUNTER 5
17 #define FAKE_ERROR_COUNTER 0
24 std::unique_ptr<XrdCl::AnyObject>
response(resp);
25 std::unique_ptr<XrdCl::XRootDStatus>
status(stat);
26 std::shared_ptr<ClientRequest> self_ref = self_reference();
27 m_self_reference =
nullptr;
36 XrdCl::ChunkInfo *read_info;
37 response->Get(read_info);
38 if (read_info ==
nullptr) {
40 ex <<
"nullptr returned from response->Get().";
41 ex.
addContext(
"XrdAdaptor::ClientRequest::HandleResponse() called.");
42 m_promise.set_exception(std::make_exception_ptr(ex));
45 if (read_info->length == 0) {
47 <<
"XrdAdaptor::ClientRequest::HandleResponse: While reading from\n " << m_manager.getFilename()
48 <<
"\n received a read_info->length = 0 and read_info->offset = " << read_info->offset;
50 m_promise.set_value(read_info->length);
52 XrdCl::VectorReadInfo *read_info;
53 response->Get(read_info);
54 if (read_info ==
nullptr) {
56 ex <<
"nullptr returned from response->Get() from vector read.";
57 ex.
addContext(
"XrdAdaptor::ClientRequest::HandleResponse() called.");
58 m_promise.set_exception(std::make_exception_ptr(ex));
61 if (read_info->GetSize() == 0) {
62 edm::LogWarning(
"XrdAdaptorInternal") <<
"XrdAdaptor::ClientRequest::HandleResponse: While reading from\n "
63 << m_manager.getFilename() <<
"\n received a read_info->GetSize() = 0";
66 m_promise.set_value(read_info->GetSize());
71 <<
"XrdRequestManager::handle(name='" << m_manager.getFilename() <<
") failure when reading from "
72 << (source ? source->
PrettyID() :
"(unknown source)") <<
"; failed with error '" << status->ToStr()
73 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
").";
77 m_manager.requestFailure(self_ref, *status);
80 if (ex.
getCode() == XrdCl::errInvalidResponse) {
81 m_promise.set_exception(std::current_exception());
86 ex.
addContext(
"XrdAdaptor::ClientRequest::HandleResponse() failure while running connection recovery");
88 ss <<
"Original error: '" << status->ToStr() <<
"' (errno=" << status->errNo <<
", code=" << status->code
89 <<
", source=" << (source ? source->
PrettyID() :
"(unknown source)") <<
").";
91 m_promise.set_exception(std::current_exception());
92 edm::LogWarning(
"XrdAdaptorInternal") <<
"Caught a CMSSW exception when running connection recovery.";
95 ex <<
"XrdRequestManager::handle(name='" << m_manager.getFilename() <<
") failed with error '" << status->ToStr()
96 <<
"' (errno=" << status->errNo <<
", code=" << status->code <<
"). Unknown exception occurred when running"
97 <<
" connection recovery.";
98 ex.
addContext(
"Calling XrdRequestManager::handle()");
99 m_manager.addConnections(ex);
101 m_promise.set_exception(std::make_exception_ptr(ex));
102 edm::LogWarning(
"XrdAdaptorInternal") <<
"Caught a new exception when running connection recovery.";
const std::string & PrettyID() const
~ClientRequest() override
void addAdditionalInfo(std::string const &info)
void addContext(std::string const &context)
void swap(QualityMetricWatch &)
#define FAKE_ERROR_COUNTER
Log< level::Warning, false > LogWarning
static std::string const source
static std::atomic< int > g_fakeError
void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override