![]() |
XRootD
|
Handle/Process/Forward XRootD messages. More...
#include <XrdClXRootDMsgHandler.hh>
Public Member Functions | |
XRootDMsgHandler (Message *msg, ResponseHandler *respHandler, const URL *url, std::shared_ptr< SIDManager > sidMgr, LocalFileHandler *lFileHandler) | |
~XRootDMsgHandler () | |
Destructor. More... | |
virtual uint16_t | Examine (std::shared_ptr< Message > &msg) |
time_t | GetExpiration () |
Get a timestamp after which we give up. More... | |
const Message * | GetRequest () const |
Get the request pointer. More... | |
virtual uint16_t | GetSid () const |
virtual uint16_t | InspectStatusRsp () |
virtual bool | IsRaw () const |
Are we a raw writer or not? More... | |
virtual void | OnStatusReady (const Message *message, XRootDStatus status) |
The requested action has been performed and the status is available. More... | |
virtual uint8_t | OnStreamEvent (StreamEvent event, XRootDStatus status) |
void | PartialReceived () |
virtual void | Process () |
Process the message if it was "taken" by the examine action. More... | |
virtual XRootDStatus | ReadMessageBody (Message *msg, Socket *socket, uint32_t &bytesRead) |
void | SetChunkList (ChunkList *chunkList) |
Set the chunk list. More... | |
void | SetCrc32cDigests (std::vector< uint32_t > &&crc32cDigests) |
void | SetExpiration (time_t expiration) |
Set a timestamp after which we give up. More... | |
void | SetFollowMetalink (bool followMetalink) |
void | SetHostList (HostList *hostList) |
Set host list. More... | |
void | SetKernelBuffer (XrdSys::KernelBuffer *kbuff) |
Set the kernel buffer. More... | |
void | SetLoadBalancer (const HostInfo &loadBalancer) |
Set the load balancer. More... | |
void | SetOksofarAsAnswer (bool oksofarAsAnswer) |
void | SetRedirectAsAnswer (bool redirectAsAnswer) |
void | SetRedirectCounter (uint16_t redirectCounter) |
Set the redirect counter. More... | |
void | SetStateful (bool stateful) |
void | WaitDone (time_t now) |
XRootDStatus | WriteMessageBody (Socket *socket, uint32_t &bytesWritten) |
![]() | |
virtual | ~MsgHandler () |
Event types that the message handler may receive. More... | |
virtual void | OnReadyToSend (Message *msg) |
Friends | |
class | HandleRspJob |
Additional Inherited Members | |
![]() | |
enum | Action { None = 0x0000 , Nop = 0x0001 , Ignore = 0x0002 , RemoveHandler = 0x0004 , Raw = 0x0008 , NoProcess = 0x0010 , Corrupted = 0x0020 , More = 0x0040 } |
Actions to be taken after a message is processed by the handler. More... | |
enum | StreamEvent { Ready = 1 , Broken = 2 , Timeout = 3 , FatalError = 4 } |
Events that may have occurred to the stream. More... | |
Handle/Process/Forward XRootD messages.
Definition at line 119 of file XrdClXRootDMsgHandler.hh.
|
inline |
Constructor
msg | message that has been sent out |
respHandler | response handler to be called then the final final response arrives |
url | the url the message has been sent to |
sidMgr | the sid manager used to allocate SID for the initial message |
Definition at line 134 of file XrdClXRootDMsgHandler.hh.
References XrdOucPgrwUtils::csNum(), XrdCl::Log::Debug(), XrdCl::ExDbgMsg, XrdCl::Buffer::GetBuffer(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Message::GetSessionId(), kXR_pgread, kXR_read, kXR_readv, ClientPgReadRequest::offset, ClientRequestHdr::requestid, and ClientPgReadRequest::rlen.
|
inline |
Destructor.
Definition at line 209 of file XrdClXRootDMsgHandler.hh.
References XrdCl::Log::Debug(), XrdCl::ExDbgMsg, XrdCl::URL::GetHostId(), and XrdCl::DefaultEnv::GetLog().
|
virtual |
Examine an incoming message, and decide on the action to be taken
msg | the message, may be zero if receive failed |
Implements XrdCl::MsgHandler.
Definition at line 109 of file XrdClXRootDMsgHandler.cc.
References ServerResponseHeader::dlen, XrdCl::Log::Dump(), XrdCl::ExDbgMsg, XrdCl::Buffer::GetBuffer(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), ServerResponse::hdr, ClientRequest::header, XrdCl::MsgHandler::Ignore, kXR_attn, kXR_error, kXR_ok, kXR_oksofar, kXR_pgwrite, kXR_read, kXR_readv, kXR_redirect, kXR_status, kXR_wait, kXR_waitresp, XrdCl::MsgHandler::None, XrdCl::MsgHandler::NoProcess, XrdCl::MsgHandler::Raw, XrdCl::MsgHandler::RemoveHandler, ClientRequestHdr::requestid, ServerResponseHeader::status, ClientRequestHdr::streamid, ServerResponseHeader::streamid, XrdSysCondVar::Wait(), XrdCl::Log::Warning(), and XrdCl::XRootDMsg.
|
inlinevirtual |
Get a timestamp after which we give up.
Implements XrdCl::MsgHandler.
Definition at line 330 of file XrdClXRootDMsgHandler.hh.
|
inline |
Get the request pointer.
Definition at line 356 of file XrdClXRootDMsgHandler.hh.
|
virtual |
Get handler sid
return sid of the corresponding request, otherwise 0
Implements XrdCl::MsgHandler.
Definition at line 389 of file XrdClXRootDMsgHandler.cc.
References XrdCl::Buffer::GetBuffer(), ClientRequest::header, and ClientRequestHdr::streamid.
|
virtual |
Reexamine the incoming message, and decide on the action to be taken
In case of kXR_status the message can be only fully examined after reading the whole body (without raw data).
msg | the message, may be zero if receive failed |
Implements XrdCl::MsgHandler.
Definition at line 299 of file XrdClXRootDMsgHandler.cc.
References ServerResponseStatus::bdy, XrdCl::Status::code, XrdCl::MsgHandler::Corrupted, ServerResponseHeader::dlen, ServerResponseBody_Status::dlen, XrdCl::errDataError, XrdCl::Log::Error(), XrdCl::Buffer::GetBuffer(), XrdCl::XRootDStatus::GetErrorMessage(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), ServerResponseStatus::hdr, ServerResponse::hdr, ClientRequest::header, XrdCl::MsgHandler::Ignore, XrdCl::Status::IsOK(), XrdProto::kXR_PartialResult, kXR_pgread, kXR_pgwrite, kXR_status, XrdCl::MsgHandler::More, XrdCl::MsgHandler::NoProcess, XrdCl::MsgHandler::Raw, XrdCl::MsgHandler::RemoveHandler, ClientRequestHdr::requestid, ServerResponseBody_Status::resptype, ServerResponseHeader::status, ServerResponseV2::status, XrdCl::XRootDTransport::UnMarshalStatusBody(), and XrdCl::XRootDMsg.
|
virtual |
Are we a raw writer or not?
Reimplemented from XrdCl::MsgHandler.
Definition at line 929 of file XrdClXRootDMsgHandler.cc.
References ClientRequest::chkpoint, XrdCl::Buffer::GetBuffer(), ClientRequest::header, kXR_chkpoint, kXR_ckpXeq, kXR_pgwrite, kXR_truncate, kXR_write, kXR_writev, ClientChkPointRequest::opcode, and ClientRequestHdr::requestid.
|
virtual |
The requested action has been performed and the status is available.
Implements XrdCl::MsgHandler.
Definition at line 896 of file XrdClXRootDMsgHandler.cc.
References XrdCl::Log::Debug(), XrdCl::Log::Dump(), XrdCl::Log::Error(), XrdCl::ExDbgMsg, XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::Status::IsOK(), and XrdCl::XRootDMsg.
|
virtual |
Handle an event other that a message arrival
event | type of the event |
status | status info |
Reimplemented from XrdCl::MsgHandler.
Definition at line 859 of file XrdClXRootDMsgHandler.cc.
References XrdCl::Log::Dump(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::MsgHandler::Ready, XrdCl::MsgHandler::RemoveHandler, and XrdCl::XRootDMsg.
void XrdCl::XRootDMsgHandler::PartialReceived | ( | ) |
Bookkeeping after partial response has been received:
Definition at line 1106 of file XrdClXRootDMsgHandler.cc.
Referenced by XrdCl::Stream::ForceError(), XrdCl::Stream::OnError(), and XrdCl::Stream::OnIncoming().
|
virtual |
Process the message if it was "taken" by the examine action.
Process the message if it was "taken" by the examine action
msg | the message to be processed |
Reimplemented from XrdCl::MsgHandler.
Definition at line 398 of file XrdClXRootDMsgHandler.cc.
References ServerResponse::body, XrdCl::Utils::CheckEC(), XrdCl::PostMaster::CollapseRedirect(), XrdCl::Log::Debug(), XrdCl::DefaultMaxMetalinkWait, ServerResponseHeader::dlen, XrdCl::Log::Dump(), XrdCl::RedirectEntry::EntryRedirect, XrdCl::RedirectEntry::EntryRedirectOnWait, XrdCl::errErrorResponse, XrdCl::errInvalidMessage, XrdCl::errInvalidRedirectURL, XrdCl::errInvalidResponse, XrdCl::errOperationExpired, XrdCl::Log::Error(), XrdCl::errRedirect, XrdCl::errRedirectLimit, XrdCl::ExDbgMsg, XrdCl::AnyObject::Get(), XrdCl::Buffer::GetBuffer(), XrdCl::DefaultEnv::GetEnv(), XrdCl::URL::GetHostId(), XrdCl::Env::GetInt(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::URL::GetParams(), XrdCl::URL::GetPassword(), XrdCl::URL::GetProtocol(), XrdCl::PostMaster::GetTaskManager(), XrdCl::URL::GetURL(), XrdCl::URL::GetUserName(), ServerResponse::hdr, ClientRequest::header, XrdCl::URL::IsLocalFile(), XrdCl::URL::IsMetalink(), XrdCl::Status::IsOK(), XrdCl::URL::IsValid(), kXR_attrMeta, kXR_collapseRedir, kXR_ecRedir, kXR_error, kXR_isManager, kXR_isServer, kXR_ok, kXR_oksofar, kXR_PROTOCOLVERSION, kXR_recoverWrts, kXR_redirect, kXR_status, kXR_wait, kXR_waitresp, XrdCl::XRootDQuery::ProtocolVersion, XrdCl::PostMaster::QueryTransport(), XrdCl::TaskManager::RegisterTask(), ClientRequestHdr::requestid, XrdCl::XRootDQuery::ServerFlags, XrdCl::URL::SetParams(), XrdCl::URL::SetPassword(), XrdCl::URL::SetProtocol(), XrdCl::URL::SetUserName(), XrdCl::Utils::splitString(), ServerResponseHeader::status, XrdCl::stError, XrdCl::stFatal, XrdCl::stOK, XrdCl::suContinue, XrdCl::Status::ToString(), XrdCl::XRootDTransport::UnMarshallBody(), XrdCl::HostInfo::url, XrdCl::Log::Warning(), and XrdCl::XRootDMsg.
|
virtual |
Read message body directly from a socket - called if Examine returns Raw flag - only socket related errors may be returned here
msg | the corresponding message header |
socket | the socket to read from |
bytesRead | number of bytes read by the method |
Reimplemented from XrdCl::MsgHandler.
Definition at line 879 of file XrdClXRootDMsgHandler.cc.
References XrdCl::Buffer::GetBuffer(), ClientRequest::header, kXR_pgread, and ClientRequestHdr::requestid.
|
inline |
Set the chunk list.
Definition at line 383 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Definition at line 394 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::SendMessage().
|
inline |
Set a timestamp after which we give up.
Definition at line 322 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Definition at line 415 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage().
|
inline |
Set host list.
Definition at line 375 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Set the kernel buffer.
Definition at line 402 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::SendMessage().
|
inline |
Set the load balancer.
Definition at line 364 of file XrdClXRootDMsgHandler.hh.
References XrdCl::URL::IsValid(), and XrdCl::HostInfo::url.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Treat the kXR_oksofar response as a valid answer to the message and notify the handler with the URL as a response
Definition at line 348 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Treat the kXR_redirect response as a valid answer to the message and notify the handler with the URL as a response
Definition at line 339 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Set the redirect counter.
Definition at line 410 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::RedirectMessage(), and XrdCl::MessageUtils::SendMessage().
|
inline |
Definition at line 420 of file XrdClXRootDMsgHandler.hh.
Referenced by XrdCl::MessageUtils::SendMessage().
void XrdCl::XRootDMsgHandler::WaitDone | ( | time_t | now | ) |
Called after the wait time for kXR_wait has elapsed
now | current timestamp |
Definition at line 1098 of file XrdClXRootDMsgHandler.cc.
References XrdCl::RedirectEntry::EntryWait.
|
virtual |
Write message body directly to a socket - called if IsRaw returns true - only socket related errors may be returned here
socket | the socket to read from |
bytesWritten | number of bytes written by the method |
Reimplemented from XrdCl::MsgHandler.
Definition at line 949 of file XrdClXRootDMsgHandler.cc.
References XrdCl::Buffer::AdvanceCursor(), XrdCl::ChunkInfo::buffer, XrdCl::Status::code, XrdOucPgrwUtils::csNum(), XrdCl::Log::Debug(), XrdSys::KernelBuffer::Empty(), XrdCl::errInternal, XrdCl::Buffer::GetBuffer(), XrdCl::Buffer::GetBufferAtCursor(), XrdCl::Buffer::GetCursor(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::Socket::IsEncrypted(), XrdCl::Status::IsOK(), XrdCl::ChunkInfo::length, XrdSys::Move(), XrdCl::ChunkInfo::offset, XrdSys::PageSize, XrdCl::Socket::Send(), XrdCl::Buffer::SetCursor(), XrdCl::stError, XrdCl::suRetry, and XrdCl::XRootDMsg.
|
friend |
Definition at line 121 of file XrdClXRootDMsgHandler.hh.