|
xrootd
|
#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, uint16_t streamNum) | |
| Constructor. More... | |
| ~Stream () | |
| Destructor. More... | |
| Status | Initialize () |
| Initializer. More... | |
| Status | Send (Message *msg, OutgoingMsgHandler *handler, bool stateful, time_t expires) |
| Queue the message for sending. More... | |
| void | SetTransport (TransportHandler *transport) |
| Set the transport. More... | |
| void | SetPoller (Poller *poller) |
| Set the poller. More... | |
| void | SetIncomingQueue (InQueue *incomingQueue) |
| Set the incoming queue. More... | |
| void | SetChannelData (AnyObject *channelData) |
| Set the channel data. More... | |
| void | SetTaskManager (TaskManager *taskManager) |
| Set task manager. More... | |
| Status | EnableLink (PathID &path) |
| void | Disconnect (bool force=false) |
| Disconnect the stream. More... | |
| void | Tick (time_t now) |
| const URL * | GetURL () const |
| Get the URL. More... | |
| uint16_t | GetStreamNumber () const |
| Get the stream number. More... | |
| void | ForceConnect () |
| Force connection. More... | |
| const std::string & | GetName () const |
| Return stream name. More... | |
| void | OnIncoming (uint16_t subStream, Message *msg) |
| Call back when a message has been reconstructed. More... | |
| Message * | OnReadyToWrite (uint16_t subStream) |
| void | OnMessageSent (uint16_t subStream, Message *msg) |
| void | OnConnect (uint16_t subStream) |
| Call back when a message has been reconstructed. More... | |
| void | OnConnectError (uint16_t subStream, Status status) |
| On connect error. More... | |
| void | OnError (uint16_t subStream, Status status) |
| On error. More... | |
| void | OnReadTimeout (uint16_t subStream) |
| On read timeout. More... | |
| void | OnWriteTimeout (uint16_t subStream) |
| On write timeout. More... | |
| void | RegisterEventHandler (ChannelEventHandler *handler) |
| Register channel event handler. More... | |
| void | RemoveEventHandler (ChannelEventHandler *handler) |
| Remove a channel event handler. More... | |
Private Types | |
| typedef std::vector < SubStreamData * > | SubStreamList |
Private Member Functions | |
| void | OnFatalError (uint16_t subStream, Status status, XrdSysMutexHelper &lock) |
| On fatal error - unlocks the stream. More... | |
| void | MonitorDisconnection (Status status) |
| Inform the monitoring about disconnection. More... | |
Private Attributes | |
| const URL * | pUrl |
| uint16_t | pStreamNum |
| std::string | pStreamName |
| TransportHandler * | pTransport |
| Poller * | pPoller |
| TaskManager * | pTaskManager |
| XrdSysRecMutex | pMutex |
| InQueue * | pIncomingQueue |
| AnyObject * | pChannelData |
| uint16_t | pLastStreamError |
| uint16_t | pStreamErrorWindow |
| uint16_t | pConnectionCount |
| uint16_t | pConnectionRetry |
| time_t | pConnectionInitTime |
| uint16_t | pConnectionWindow |
| SubStreamList | pSubStreams |
| std::vector< sockaddr_in > | pAddresses |
| ChannelHandlerList | pChannelEvHandlers |
| uint64_t | pSessionId |
| timeval | pConnectionStarted |
| timeval | pConnectionDone |
| uint64_t | pBytesSent |
| uint64_t | pBytesReceived |
|
private |
Status of the stream.
| Enumerator | |
|---|---|
| Disconnected |
Not connected. |
| Connected |
Connected. |
| Connecting |
In the process of being connected. |
| Error |
Broken. |
| XrdCl::Stream::Stream | ( | const URL * | url, |
| uint16_t | streamNum | ||
| ) |
Constructor.
References XrdCl::DefaultConnectionRetry, XrdCl::DefaultConnectionWindow, XrdCl::DefaultStreamErrorWindow, XrdCl::DefaultEnv::GetEnv(), XrdCl::URL::GetHostId(), XrdCl::Env::GetInt(), pConnectionDone, pConnectionRetry, pConnectionStarted, pConnectionWindow, pStreamErrorWindow, pStreamName, pStreamNum, and pUrl.
| XrdCl::Stream::~Stream | ( | ) |
Destructor.
References XrdCl::Log::Debug(), Disconnect(), XrdCl::DefaultEnv::GetLog(), MonitorDisconnection(), XrdCl::PostMasterMsg, pStreamName, and pSubStreams.
| void XrdCl::Stream::Disconnect | ( | bool | force = false | ) |
Disconnect the stream.
Referenced by ~Stream().
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
References XrdCl::Socket::Connected, XrdCl::Socket::Connecting, XrdCl::Socket::Disconnected, XrdCl::PathID::down, XrdCl::errConnectionError, XrdCl::Log::Error(), XrdCl::Utils::GetHostAddresses(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::Status::IsOK(), XrdCl::Utils::LogHostAddresses(), pAddresses, pConnectionCount, pConnectionInitTime, pConnectionStarted, pConnectionWindow, pLastStreamError, pMutex, XrdCl::PostMasterMsg, pStreamErrorWindow, pStreamName, pSubStreams, pUrl, XrdCl::Status::status, XrdCl::stFatal, and XrdCl::PathID::up.
Referenced by ForceConnect(), OnConnectError(), OnError(), and Send().
| void XrdCl::Stream::ForceConnect | ( | ) |
Force connection.
References XrdCl::Socket::Disconnected, EnableLink(), XrdCl::Status::IsOK(), OnConnectError(), pMutex, and pSubStreams.
|
inline |
Return stream name.
References pStreamName.
|
inline |
Get the stream number.
References pStreamNum.
Referenced by XrdCl::AsyncSocketHandler::Close(), XrdCl::AsyncSocketHandler::OnConnectionReturn(), and XrdCl::AsyncSocketHandler::SetStream().
|
inline |
Get the URL.
References pUrl.
Referenced by XrdCl::AsyncSocketHandler::OnConnectionReturn(), and XrdCl::AsyncSocketHandler::SetStream().
| Status XrdCl::Stream::Initialize | ( | ) |
Initializer.
References XrdCl::errUninitialized, pChannelData, pPoller, pSubStreams, pTransport, XrdCl::AsyncSocketHandler::SetStream(), and XrdCl::stError.
|
private |
Inform the monitoring about disconnection.
References XrdCl::Monitor::DisconnectInfo::cTime, XrdCl::Monitor::EvDisconnect, XrdCl::Monitor::Event(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetMonitor(), pBytesReceived, pBytesSent, pConnectionDone, pUrl, XrdCl::Monitor::DisconnectInfo::rBytes, XrdCl::Monitor::DisconnectInfo::sBytes, XrdCl::Monitor::DisconnectInfo::server, and XrdCl::Monitor::DisconnectInfo::status.
| void XrdCl::Stream::OnConnect | ( | uint16_t | subStream | ) |
Call back when a message has been reconstructed.
References XrdCl::Monitor::ConnectInfo::auth, XrdCl::TransportQuery::Auth, XrdCl::Socket::Connected, XrdCl::Socket::Connecting, XrdCl::Log::Debug(), XrdCl::Monitor::ConnectInfo::eTOD, XrdCl::Monitor::EvConnect, XrdCl::Monitor::Event(), XrdCl::AnyObject::Get(), XrdCl::URL::GetHostId(), XrdCl::DefaultEnv::GetLog(), XrdCl::DefaultEnv::GetMonitor(), XrdCl::Status::IsOK(), pBytesReceived, pBytesSent, pChannelData, pConnectionCount, pConnectionDone, pConnectionStarted, pConnectionWindow, pLastStreamError, pMutex, XrdCl::PostMasterMsg, pPoller, pSessionId, pStreamName, pSubStreams, pTransport, pUrl, XrdCl::TransportHandler::Query(), XrdCl::Monitor::ConnectInfo::server, XrdCl::AsyncSocketHandler::SetStream(), XrdCl::Monitor::ConnectInfo::sTOD, XrdCl::Monitor::ConnectInfo::streams, and XrdCl::TransportHandler::SubStreamNumber().
Referenced by XrdCl::AsyncSocketHandler::OnReadWhileHandshaking().
| void XrdCl::Stream::OnConnectError | ( | uint16_t | subStream, |
| Status | status | ||
| ) |
On connect error.
References XrdCl::Socket::Connected, XrdCl::Socket::Connecting, XrdCl::Socket::Disconnected, EnableLink(), XrdCl::DefaultEnv::GetLog(), XrdCl::Log::Info(), XrdCl::Status::IsFatal(), XrdCl::Status::IsOK(), OnFatalError(), pAddresses, pConnectionCount, pConnectionInitTime, pConnectionRetry, pConnectionWindow, pMutex, XrdCl::PostMasterMsg, pStreamName, pSubStreams, pTaskManager, and XrdCl::TaskManager::RegisterTask().
Referenced by ForceConnect(), XrdCl::AsyncSocketHandler::OnConnectionReturn(), and XrdCl::AsyncSocketHandler::OnFaultWhileHandshaking().
| void XrdCl::Stream::OnError | ( | uint16_t | subStream, |
| Status | status | ||
| ) |
On error.
References XrdCl::IncomingMsgHandler::Broken, XrdCl::Socket::Connected, XrdCl::Log::Debug(), XrdCl::Socket::Disconnected, EnableLink(), XrdCl::OutMessageHelper::expires, XrdCl::DefaultEnv::GetLog(), XrdCl::OutQueue::GrabStateful(), XrdCl::OutMessageHelper::handler, XrdCl::Status::IsOK(), MonitorDisconnection(), XrdCl::OutMessageHelper::msg, OnFatalError(), pChannelEvHandlers, pIncomingQueue, pMutex, XrdCl::PostMasterMsg, pStreamName, pStreamNum, pSubStreams, XrdCl::OutQueue::Report(), XrdCl::ChannelHandlerList::ReportEvent(), XrdCl::InQueue::ReportStreamEvent(), XrdCl::OutMessageHelper::stateful, XrdCl::ChannelEventHandler::StreamBroken, XrdCl::Status::ToString(), and XrdSysMutexHelper::UnLock().
Referenced by XrdCl::AsyncSocketHandler::OnFault().
|
private |
On fatal error - unlocks the stream.
References XrdCl::Socket::Disconnected, XrdCl::Log::Error(), XrdCl::IncomingMsgHandler::FatalError, XrdCl::ChannelEventHandler::FatalError, XrdCl::DefaultEnv::GetLog(), XrdCl::OutQueue::GrabItems(), pChannelEvHandlers, pConnectionCount, pIncomingQueue, pLastStreamError, XrdCl::PostMasterMsg, pStreamName, pStreamNum, pSubStreams, XrdCl::OutQueue::Report(), XrdCl::ChannelHandlerList::ReportEvent(), XrdCl::InQueue::ReportStreamEvent(), XrdCl::Status::status, XrdCl::stFatal, XrdCl::Status::ToString(), and XrdSysMutexHelper::UnLock().
Referenced by OnConnectError(), and OnError().
| void XrdCl::Stream::OnIncoming | ( | uint16_t | subStream, |
| Message * | msg | ||
| ) |
Call back when a message has been reconstructed.
References XrdCl::InQueue::AddMessage(), XrdCl::Buffer::GetSize(), XrdCl::TransportHandler::Highjack(), pBytesReceived, pChannelData, pIncomingQueue, pSessionId, pTransport, and XrdCl::Message::SetSessionId().
Referenced by XrdCl::AsyncSocketHandler::OnRead().
| void XrdCl::Stream::OnMessageSent | ( | uint16_t | subStream, |
| Message * | msg | ||
| ) |
| void XrdCl::Stream::OnReadTimeout | ( | uint16_t | subStream | ) |
On read timeout.
Referenced by XrdCl::AsyncSocketHandler::OnReadTimeout().
| Message * XrdCl::Stream::OnReadyToWrite | ( | uint16_t | subStream | ) |
References XrdCl::Log::Dump(), XrdCl::OutMessageHelper::expires, XrdCl::DefaultEnv::GetLog(), XrdCl::OutMessageHelper::handler, XrdCl::OutMessageHelper::msg, XrdCl::OutgoingMsgHandler::OnReadyToSend(), pMutex, XrdCl::PostMasterMsg, pStreamNum, pSubStreams, XrdCl::OutMessageHelper::stateful, and XrdSysMutexHelper::UnLock().
Referenced by XrdCl::AsyncSocketHandler::OnWrite().
| void XrdCl::Stream::OnWriteTimeout | ( | uint16_t | subStream | ) |
On write timeout.
Referenced by XrdCl::AsyncSocketHandler::OnWriteTimeout().
| void XrdCl::Stream::RegisterEventHandler | ( | ChannelEventHandler * | handler | ) |
Register channel event handler.
References XrdCl::ChannelHandlerList::AddHandler(), and pChannelEvHandlers.
| void XrdCl::Stream::RemoveEventHandler | ( | ChannelEventHandler * | handler | ) |
Remove a channel event handler.
References pChannelEvHandlers, and XrdCl::ChannelHandlerList::RemoveHandler().
| Status XrdCl::Stream::Send | ( | Message * | msg, |
| OutgoingMsgHandler * | handler, | ||
| bool | stateful, | ||
| time_t | expires | ||
| ) |
Queue the message for sending.
References XrdCl::Socket::Connected, XrdCl::PathID::down, XrdCl::Log::Dump(), EnableLink(), XrdCl::errInvalidSession, XrdCl::Message::GetDescription(), XrdCl::DefaultEnv::GetLog(), XrdCl::Message::GetSessionId(), XrdCl::Status::IsOK(), XrdCl::TransportHandler::MultiplexSubStream(), pChannelData, pMutex, XrdCl::PostMasterMsg, pSessionId, pStreamName, pSubStreams, pTransport, XrdCl::Status::status, XrdCl::stError, XrdCl::stFatal, XrdCl::PathID::up, and XrdCl::Log::Warning().
|
inline |
Set the channel data.
References pChannelData.
|
inline |
Set the incoming queue.
References pIncomingQueue.
|
inline |
Set task manager.
References pTaskManager.
|
inline |
Set the transport.
References pTransport.
| void XrdCl::Stream::Tick | ( | time_t | now | ) |
Handle a clock event generated either by socket timeout, or by the task manager event
References XrdCl::errOperationExpired, XrdCl::OutQueue::GrabExpired(), XrdSysMutex::Lock(), pIncomingQueue, pMutex, pStreamNum, pSubStreams, XrdCl::OutQueue::Report(), XrdCl::InQueue::ReportTimeout(), XrdCl::stError, and XrdSysMutex::UnLock().
|
private |
Referenced by EnableLink(), and OnConnectError().
|
private |
Referenced by MonitorDisconnection(), OnConnect(), and OnIncoming().
|
private |
Referenced by MonitorDisconnection(), OnConnect(), and OnMessageSent().
|
private |
Referenced by Initialize(), OnConnect(), OnIncoming(), Send(), and SetChannelData().
|
private |
Referenced by OnError(), OnFatalError(), RegisterEventHandler(), and RemoveEventHandler().
|
private |
Referenced by EnableLink(), OnConnect(), OnConnectError(), and OnFatalError().
|
private |
Referenced by MonitorDisconnection(), OnConnect(), and Stream().
|
private |
Referenced by EnableLink(), and OnConnectError().
|
private |
Referenced by OnConnectError(), and Stream().
|
private |
Referenced by EnableLink(), OnConnect(), and Stream().
|
private |
Referenced by EnableLink(), OnConnect(), OnConnectError(), and Stream().
|
private |
Referenced by OnError(), OnFatalError(), OnIncoming(), SetIncomingQueue(), and Tick().
|
private |
Referenced by EnableLink(), OnConnect(), and OnFatalError().
|
private |
Referenced by EnableLink(), ForceConnect(), OnConnect(), OnConnectError(), OnError(), OnReadyToWrite(), Send(), and Tick().
|
private |
Referenced by Initialize(), OnConnect(), and SetPoller().
|
private |
Referenced by OnConnect(), OnIncoming(), and Send().
|
private |
Referenced by EnableLink(), and Stream().
|
private |
Referenced by EnableLink(), GetName(), OnConnect(), OnConnectError(), OnError(), OnFatalError(), Send(), Stream(), and ~Stream().
|
private |
Referenced by GetStreamNumber(), OnError(), OnFatalError(), OnReadyToWrite(), Stream(), and Tick().
|
private |
Referenced by EnableLink(), ForceConnect(), Initialize(), OnConnect(), OnConnectError(), OnError(), OnFatalError(), OnMessageSent(), OnReadyToWrite(), Send(), Tick(), and ~Stream().
|
private |
Referenced by OnConnectError(), and SetTaskManager().
|
private |
Referenced by Initialize(), OnConnect(), OnIncoming(), Send(), and SetTransport().
|
private |
Referenced by EnableLink(), GetURL(), MonitorDisconnection(), OnConnect(), and Stream().
1.8.3.1