#include <XrdClStream.hh>
Public Types | |
| enum | StreamStatus { Disconnected = 0 , Connected = 1 , Connecting = 2 , Error = 3 } |
| Status of the stream. More... | |
Public Member Functions | |
| Stream (const URL *url, const URL &prefer=URL()) | |
| Constructor. | |
| ~Stream () | |
| Destructor. | |
| bool | CanCollapse (const URL &url) |
| void | DisableIfEmpty (uint16_t subStream) |
| Disables respective uplink if empty. | |
| XRootDStatus | EnableLink (PathID &path) |
| void | Finalize () |
| void | ForceConnect () |
| Force connection. | |
| void | ForceError (XRootDStatus status, const bool hush, const uint64_t sess) |
| Force error. | |
| std::shared_ptr< Channel > | GetChannel () |
| const std::string & | GetName () const |
| Return stream name. | |
| const URL * | GetURL () const |
| Get the URL. | |
| XRootDStatus | Initialize () |
| Initializer. | |
| uint16_t | InspectStatusRsp (uint16_t stream, MsgHandler *&incHandler) |
| MsgHandler * | InstallIncHandler (std::shared_ptr< Message > &msg, uint16_t stream) |
| void | OnConnect (uint16_t subStream) |
| Call back when a message has been reconstructed. | |
| void | OnConnectError (uint16_t subStream, XRootDStatus status) |
| On connect error. | |
| void | OnError (uint16_t subStream, XRootDStatus status) |
| On error. | |
| void | OnIncoming (uint16_t subStream, std::shared_ptr< Message > msg, uint32_t bytesReceived) |
| Call back when a message has been reconstructed. | |
| void | OnMessageSent (uint16_t subStream, Message *msg, uint32_t bytesSent) |
| bool | OnReadTimeout (uint16_t subStream) XRD_WARN_UNUSED_RESULT |
| On read timeout. | |
| std::pair< Message *, MsgHandler * > | OnReadyToWrite (uint16_t subStream) |
| bool | OnWriteTimeout (uint16_t subStream) XRD_WARN_UNUSED_RESULT |
| On write timeout. | |
| Status | Query (uint16_t query, AnyObject &result) |
| Query the stream. | |
| void | RegisterEventHandler (ChannelEventHandler *handler) |
| Register channel event handler. | |
| void | RemoveEventHandler (ChannelEventHandler *handler) |
| Remove a channel event handler. | |
| XRootDStatus | Send (Message *msg, MsgHandler *handler, bool stateful, time_t expires) |
| Queue the message for sending. | |
| void | SetChannel (std::weak_ptr< Channel > &channel) |
| Sets a weak_ptr of our owning Channel. | |
| void | SetChannelData (AnyObject *channelData) |
| Set the channel data. | |
| void | SetIncomingQueue (InQueue *incomingQueue) |
| Set the incoming queue. | |
| void | SetJobManager (JobManager *jobManager) |
| Set job manager. | |
| void | SetOnDataConnectHandler (std::shared_ptr< Job > &onConnJob) |
| Set the on-connect handler for data streams. | |
| void | SetPoller (Poller *poller) |
| Set the poller. | |
| void | SetTaskManager (TaskManager *taskManager) |
| Set task manager. | |
| void | SetTransport (TransportHandler *transport) |
| Set the transport. | |
| void | Tick (time_t now) |
Definition at line 169 of file XrdClStream.hh.
Status of the stream.
| Enumerator | |
|---|---|
| Disconnected | Not connected. |
| Connected | Connected. |
| Connecting | In the process of being connected. |
| Error | Broken. |
Definition at line 175 of file XrdClStream.hh.
Constructor.
Definition at line 299 of file XrdClStream.cc.
References XrdCl::Log::Debug(), XrdCl::DefaultConnectionRetry, XrdCl::DefaultConnectionWindow, XrdCl::DefaultNetworkStack, XrdCl::DefaultStreamErrorWindow, XrdCl::Utils::GetIntParameter(), XrdCl::DefaultEnv::GetLog(), XrdCl::Utils::GetStringParameter(), XrdNetUtils::hasIP64, XrdNetUtils::hasIPv4, XrdNetUtils::hasIPv6, XrdCl::Utils::IPAuto, XrdCl::Utils::IPv4, XrdCl::Utils::IPv6, XrdNetUtils::NetConfig(), XrdCl::PostMasterMsg, XrdNetUtils::qryINIF, and XrdCl::Utils::String2AddressType().
| XrdCl::Stream::~Stream | ( | ) |
Destructor.
Definition at line 356 of file XrdClStream.cc.
References XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), and XrdCl::PostMasterMsg.
| bool XrdCl::Stream::CanCollapse | ( | const URL & | url | ) |
Definition at line 1395 of file XrdClStream.cc.
References XrdCl::Log::Error(), XrdCl::Utils::GetHostAddresses(), XrdCl::URL::GetHostName(), XrdCl::DefaultEnv::GetLog(), XrdCl::Status::IsOK(), and XrdCl::PostMasterMsg.
| void XrdCl::Stream::DisableIfEmpty | ( | uint16_t | subStream | ) |
Disables respective uplink if empty.
Definition at line 794 of file XrdClStream.cc.
References XrdCl::Log::Dump(), XrdCl::DefaultEnv::GetLog(), and XrdCl::PostMasterMsg.
| XRootDStatus XrdCl::Stream::EnableLink | ( | PathID & | path | ) |
Connect if needed, otherwise make sure that the underlying socket handler gets write readiness events, it will update the path with what it has actually enabled
Definition at line 391 of file XrdClStream.cc.
References XrdCl::Socket::Connected, XrdCl::Socket::Connecting, XrdCl::Socket::Disconnected, XrdCl::PathID::down, XrdCl::Log::Error(), XrdCl::Utils::GetHostAddresses(), XrdCl::DefaultEnv::GetLog(), XrdCl::Status::IsOK(), XrdCl::Utils::LogHostAddresses(), XrdCl::PostMasterMsg, XrdCl::Status::status, XrdCl::stFatal, and XrdCl::PathID::up.
Referenced by ForceConnect(), OnConnectError(), OnError(), and Send().
| void XrdCl::Stream::Finalize | ( | ) |
Used at finalize time, disconnects the stream. Assumes poller and jobmanager are not running.
Definition at line 568 of file XrdClStream.cc.
References XrdCl::Socket::Disconnected, and GetChannel().
| void XrdCl::Stream::ForceConnect | ( | ) |
Force connection.
Definition at line 552 of file XrdClStream.cc.
References XrdCl::Socket::Connecting, XrdCl::Socket::Disconnected, EnableLink(), XrdCl::Status::IsOK(), and OnConnectError().
| void XrdCl::Stream::ForceError | ( | XRootDStatus | status, |
| const bool | hush, | ||
| const uint64_t | sess ) |
Force error.
Definition at line 1141 of file XrdClStream.cc.
References XrdCl::MsgHandler::Broken, XrdCl::Socket::Connected, XrdCl::Log::Debug(), ForceError(), GetChannel(), XrdCl::DefaultEnv::GetLog(), XrdCl::OutQueue::GrabItems(), XrdCl::PostMasterMsg, XrdCl::OutQueue::Report(), XrdCl::ChannelEventHandler::StreamBroken, and XrdCl::Status::ToString().
Referenced by ForceError().
|
inline |
Gets a shared_ptr of our owning Channel. Used to by our AsyncSocketHandlers to obtain a ref count, and internally to ensure Channel (and thus ourselves) remains alive during error-event handlers that close sockets.
Definition at line 414 of file XrdClStream.hh.
Referenced by Finalize(), ForceError(), OnConnect(), OnConnectError(), OnError(), and OnReadTimeout().
|
inline |
Return stream name.
Definition at line 297 of file XrdClStream.hh.
|
inline |
| XRootDStatus XrdCl::Stream::Initialize | ( | ) |
Initializer.
Definition at line 375 of file XrdClStream.cc.
References XrdCl::errUninitialized, and XrdCl::stError.
| uint16_t XrdCl::Stream::InspectStatusRsp | ( | uint16_t | stream, |
| MsgHandler *& | incHandler ) |
In case the message is a kXR_status response it needs further attention
Definition at line 1364 of file XrdClStream.cc.
References XrdCl::InMessageHelper::action, XrdCl::MsgHandler::Corrupted, XrdCl::InMessageHelper::handler, XrdCl::MsgHandler::InspectStatusRsp(), XrdCl::MsgHandler::More, XrdCl::MsgHandler::None, XrdCl::MsgHandler::Raw, and XrdCl::MsgHandler::RemoveHandler.
| MsgHandler * XrdCl::Stream::InstallIncHandler | ( | std::shared_ptr< Message > & | msg, |
| uint16_t | stream ) |
Install a message handler for the given message if there is one available, if the handler want's to be called in the raw mode it will be returned, the message ownership flag is returned in any case
| msg | message header |
| stream | stream concerned |
Definition at line 1343 of file XrdClStream.cc.
References XrdCl::InMessageHelper::action, XrdCl::InMessageHelper::expires, XrdCl::InMessageHelper::handler, and XrdCl::MsgHandler::Raw.
| void XrdCl::Stream::OnConnect | ( | uint16_t | subStream | ) |
Call back when a message has been reconstructed.
Definition at line 834 of file XrdClStream.cc.
References XrdCl::TransportQuery::Auth, XrdCl::Monitor::ConnectInfo::auth, XrdCl::Socket::Connected, XrdCl::Socket::Connecting, XrdCl::Log::Debug(), XrdCl::Socket::Disconnected, XrdCl::Monitor::ConnectInfo::eTOD, XrdCl::Monitor::EvConnect, XrdCl::Monitor::Event(), XrdCl::AnyObject::Get(), GetChannel(), XrdCl::DefaultEnv::GetLog(), XrdCl::DefaultEnv::GetMonitor(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Status::IsOK(), XrdCl::PostMaster::NotifyConnectHandler(), XrdCl::PostMasterMsg, XrdCl::Monitor::ConnectInfo::server, XrdCl::Monitor::ConnectInfo::sTOD, and XrdCl::Monitor::ConnectInfo::streams.
| void XrdCl::Stream::OnConnectError | ( | uint16_t | subStream, |
| XRootDStatus | status ) |
On connect error.
Definition at line 947 of file XrdClStream.cc.
References XrdCl::Socket::Connected, XrdCl::Socket::Connecting, XrdCl::Socket::Disconnected, EnableLink(), XrdCl::Log::Error(), GetChannel(), XrdCl::DefaultEnv::GetLog(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Log::Info(), XrdCl::Status::IsFatal(), XrdCl::Status::IsOK(), XrdCl::PostMaster::NotifyConnErrHandler(), and XrdCl::PostMasterMsg.
Referenced by ForceConnect().
| void XrdCl::Stream::OnError | ( | uint16_t | subStream, |
| XRootDStatus | status ) |
On error.
Definition at line 1052 of file XrdClStream.cc.
References XrdCl::MsgHandler::Broken, XrdCl::Socket::Connected, XrdCl::Log::Debug(), XrdCl::Socket::Disconnected, EnableLink(), GetChannel(), XrdCl::DefaultEnv::GetLog(), XrdCl::OutQueue::GrabStateful(), XrdCl::Status::IsOK(), XrdCl::PostMasterMsg, XrdCl::OutQueue::Report(), XrdCl::ChannelEventHandler::StreamBroken, XrdCl::Status::ToString(), and XrdCl::StreamMutexHelper::UnLock().
Referenced by OnReadTimeout().
| void XrdCl::Stream::OnIncoming | ( | uint16_t | subStream, |
| std::shared_ptr< Message > | msg, | ||
| uint32_t | bytesReceived ) |
Call back when a message has been reconstructed.
Definition at line 678 of file XrdClStream.cc.
References XrdCl::InMessageHelper::action, XrdCl::TransportHandler::DigestMsg, XrdCl::Log::Dump(), XrdCl::DefaultEnv::GetLog(), XrdCl::InMessageHelper::handler, ServerResponse::hdr, XrdCl::MsgHandler::Ignore, XrdCl::MsgHandler::NoProcess, XrdCl::XRootDMsgHandler::PartialReceived(), XrdCl::PostMasterMsg, XrdCl::TransportHandler::RequestClose, XrdCl::InMessageHelper::Reset(), ServerResponseHeader::status, ServerResponseHeader::streamid, and XrdCl::Log::Warning().
| void XrdCl::Stream::OnMessageSent | ( | uint16_t | subStream, |
| Message * | msg, | ||
| uint32_t | bytesSent ) |
Definition at line 812 of file XrdClStream.cc.
References XrdCl::OutQueue::MsgHelper::handler, XrdCl::MsgHandler::OnStatusReady(), and XrdCl::OutQueue::MsgHelper::Reset().
| bool XrdCl::Stream::OnReadTimeout | ( | uint16_t | subStream | ) |
On read timeout.
Definition at line 1248 of file XrdClStream.cc.
References XrdCl::Log::Debug(), XrdCl::PostMaster::ForceDisconnect(), GetChannel(), XrdCl::DefaultEnv::GetLog(), XrdCl::DefaultEnv::GetPostMaster(), XrdCl::Status::IsOK(), OnError(), XrdCl::PostMasterMsg, and XrdCl::StreamMutexHelper::UnLock().
| std::pair< Message *, MsgHandler * > XrdCl::Stream::OnReadyToWrite | ( | uint16_t | subStream | ) |
Definition at line 752 of file XrdClStream.cc.
References XrdCl::Log::Debug(), XrdCl::Log::Dump(), XrdCl::OutQueue::MsgHelper::expires, XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::OutQueue::MsgHelper::handler, XrdCl::OutQueue::MsgHelper::msg, XrdCl::MsgHandler::OnReadyToSend(), XrdCl::PostMasterMsg, XrdCl::OutQueue::MsgHelper::stateful, XrdCl::StreamMutexHelper::UnLock(), and XrdCl::Log::Warning().
| bool XrdCl::Stream::OnWriteTimeout | ( | uint16_t | subStream | ) |
Query the stream.
Definition at line 1440 of file XrdClStream.cc.
References XrdCl::errQueryNotSupported, XrdCl::StreamQuery::HostName, XrdCl::StreamQuery::IpAddr, XrdCl::StreamQuery::IpStack, XrdCl::AnyObject::Set(), and XrdCl::stError.
| void XrdCl::Stream::RegisterEventHandler | ( | ChannelEventHandler * | handler | ) |
Register channel event handler.
Definition at line 1326 of file XrdClStream.cc.
| void XrdCl::Stream::RemoveEventHandler | ( | ChannelEventHandler * | handler | ) |
Remove a channel event handler.
Definition at line 1334 of file XrdClStream.cc.
| XRootDStatus XrdCl::Stream::Send | ( | Message * | msg, |
| MsgHandler * | handler, | ||
| bool | stateful, | ||
| time_t | expires ) |
Queue the message for sending.
Definition at line 501 of file XrdClStream.cc.
References XrdCl::Socket::Connected, XrdCl::PathID::down, XrdCl::Log::Dump(), EnableLink(), XrdCl::errInvalidSession, XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetObfuscatedDescription(), XrdCl::Message::GetSessionId(), XrdCl::Status::IsOK(), XrdCl::MsgHandler::OnWaitingToSend(), XrdCl::PostMasterMsg, XrdCl::Status::status, XrdCl::stError, XrdCl::stFatal, XrdCl::PathID::up, and XrdCl::Log::Warning().
|
inline |
Sets a weak_ptr of our owning Channel.
Definition at line 233 of file XrdClStream.hh.
|
inline |
Set the channel data.
Definition at line 241 of file XrdClStream.hh.
|
inline |
Set the incoming queue.
Definition at line 225 of file XrdClStream.hh.
|
inline |
Set job manager.
Definition at line 257 of file XrdClStream.hh.
|
inline |
Set the on-connect handler for data streams.
Definition at line 391 of file XrdClStream.hh.
|
inline |
|
inline |
Set task manager.
Definition at line 249 of file XrdClStream.hh.
|
inline |
Set the transport.
Definition at line 209 of file XrdClStream.hh.
| void XrdCl::Stream::Tick | ( | time_t | now | ) |
Handle a clock event generated either by socket timeout, or by the task manager event
Definition at line 584 of file XrdClStream.cc.
References XrdCl::errOperationExpired, XrdCl::OutQueue::GrabExpired(), XrdCl::OutQueue::Report(), XrdCl::stError, and XrdCl::StreamMutexHelper::UnLock().