|
xrootd
|
#include <XrdClStream.hh>

Classes | |
| class | HandleIncMsgJob |
| class | QueueIncMsgJob |
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. | |
| ~Stream () | |
| Destructor. | |
| Status | Initialize () |
| Initializer. | |
| Status | Send (Message *msg, OutgoingMsgHandler *handler, bool stateful, time_t expires) |
| Queue the message for sending. | |
| void | SetTransport (TransportHandler *transport) |
| Set the transport. | |
| void | SetPoller (Poller *poller) |
| Set the poller. | |
| void | SetIncomingQueue (InQueue *incomingQueue) |
| Set the incoming queue. | |
| void | SetChannelData (AnyObject *channelData) |
| Set the channel data. | |
| void | SetTaskManager (TaskManager *taskManager) |
| Set task manager. | |
| void | SetJobManager (JobManager *jobManager) |
| Set job manager. | |
| Status | EnableLink (PathID &path) |
| void | Disconnect (bool force=false) |
| Disconnect the stream. | |
| void | Tick (time_t now) |
| const URL * | GetURL () const |
| Get the URL. | |
| uint16_t | GetStreamNumber () const |
| Get the stream number. | |
| void | ForceConnect () |
| Force connection. | |
| const std::string & | GetName () const |
| Return stream name. | |
| void | OnIncoming (uint16_t subStream, Message *msg, uint32_t bytesReceived) |
| Call back when a message has been reconstructed. | |
| std::pair< Message *, OutgoingMsgHandler * > | OnReadyToWrite (uint16_t subStream) |
| void | OnMessageSent (uint16_t subStream, Message *msg, uint32_t bytesSent) |
| void | OnConnect (uint16_t subStream) |
| Call back when a message has been reconstructed. | |
| void | OnConnectError (uint16_t subStream, Status status) |
| On connect error. | |
| void | OnError (uint16_t subStream, Status status) |
| On error. | |
| void | OnReadTimeout (uint16_t subStream) |
| On read timeout. | |
| void | OnWriteTimeout (uint16_t subStream) |
| On write timeout. | |
| void | RegisterEventHandler (ChannelEventHandler *handler) |
| Register channel event handler. | |
| void | RemoveEventHandler (ChannelEventHandler *handler) |
| Remove a channel event handler. | |
| std::pair< IncomingMsgHandler *, bool > | InstallIncHandler (Message *msg, uint16_t stream) |
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. | |
| void | MonitorDisconnection (Status status) |
| Inform the monitoring about disconnection. | |
Private Attributes | |
| const URL * | pUrl |
| uint16_t | pStreamNum |
| std::string | pStreamName |
| TransportHandler * | pTransport |
| Poller * | pPoller |
| TaskManager * | pTaskManager |
| JobManager * | pJobManager |
| 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 |
| QueueIncMsgJob * | pQueueIncMsgJob |
| timeval | pConnectionStarted |
| timeval | pConnectionDone |
| uint64_t | pBytesSent |
| uint64_t | pBytesReceived |
typedef std::vector<SubStreamData*> XrdCl::Stream::SubStreamList [private] |
Status of the stream.
| 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.
Destructor.
References XrdCl::Log::Debug(), Disconnect(), XrdCl::DefaultEnv::GetLog(), MonitorDisconnection(), XrdCl::PostMasterMsg, pQueueIncMsgJob, pStreamName, and pSubStreams.
| void XrdCl::Stream::Disconnect | ( | bool | force = false | ) |
Disconnect the stream.
Referenced by ~Stream().
| Status 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
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 Disconnected, EnableLink(), XrdCl::Status::IsOK(), OnConnectError(), pMutex, and pSubStreams.
| const std::string& XrdCl::Stream::GetName | ( | ) | const [inline] |
Return stream name.
References pStreamName.
| uint16_t XrdCl::Stream::GetStreamNumber | ( | ) | const [inline] |
Get the stream number.
References pStreamNum.
Referenced by XrdCl::AsyncSocketHandler::Close(), XrdCl::AsyncSocketHandler::OnConnectionReturn(), and XrdCl::AsyncSocketHandler::SetStream().
| const URL* XrdCl::Stream::GetURL | ( | ) | const [inline] |
Get the URL.
References pUrl.
Referenced by XrdCl::AsyncSocketHandler::OnConnectionReturn(), and XrdCl::AsyncSocketHandler::SetStream().
Initializer.
References XrdCl::errUninitialized, pChannelData, pPoller, pSubStreams, pTransport, XrdCl::AsyncSocketHandler::SetStream(), and XrdCl::stError.
| std::pair< IncomingMsgHandler *, bool > XrdCl::Stream::InstallIncHandler | ( | 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 |
References XrdCl::InMessageHelper::action, XrdCl::InMessageHelper::expires, XrdCl::InQueue::GetHandlerForMessage(), XrdCl::InMessageHelper::handler, pIncomingQueue, pSubStreams, XrdCl::IncomingMsgHandler::Raw, PC3::stream(), and XrdCl::IncomingMsgHandler::Take.
Referenced by XrdCl::AsyncSocketHandler::OnRead().
| void XrdCl::Stream::MonitorDisconnection | ( | Status | status | ) | [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, Connected, 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, 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, Disconnected, EnableLink(), XrdCl::OutMessageHelper::expires, XrdCl::InMessageHelper::expires, XrdCl::DefaultEnv::GetLog(), XrdCl::OutQueue::GrabStateful(), XrdCl::OutMessageHelper::handler, XrdCl::InMessageHelper::handler, XrdCl::Status::IsOK(), MonitorDisconnection(), XrdCl::OutMessageHelper::msg, OnFatalError(), pChannelEvHandlers, pIncomingQueue, pMutex, XrdCl::PostMasterMsg, pStreamName, pStreamNum, pSubStreams, XrdCl::InQueue::ReAddMessageHandler(), XrdCl::OutQueue::Report(), XrdCl::ChannelHandlerList::ReportEvent(), XrdCl::InQueue::ReportStreamEvent(), XrdCl::InMessageHelper::Reset(), XrdCl::OutMessageHelper::stateful, XrdCl::ChannelEventHandler::StreamBroken, XrdCl::Status::ToString(), and XrdSysMutexHelper::UnLock().
Referenced by XrdCl::AsyncSocketHandler::OnFault().
| void XrdCl::Stream::OnFatalError | ( | uint16_t | subStream, |
| Status | status, | ||
| XrdSysMutexHelper & | lock | ||
| ) | [private] |
On fatal error - unlocks the stream.
References 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, | ||
| uint32_t | bytesReceived | ||
| ) |
Call back when a message has been reconstructed.
References XrdCl::InMessageHelper::action, XrdCl::TransportHandler::DigestMsg, XrdCl::Log::Dump(), XrdCl::InMessageHelper::expires, XrdCl::Message::GetDescription(), XrdCl::DefaultEnv::GetLog(), XrdCl::InMessageHelper::handler, XrdCl::IncomingMsgHandler::NoProcess, pBytesReceived, pChannelData, pIncomingQueue, pJobManager, XrdCl::PostMasterMsg, pQueueIncMsgJob, pSessionId, pStreamName, pSubStreams, pTransport, XrdCl::JobManager::QueueJob(), XrdCl::InQueue::ReAddMessageHandler(), XrdCl::IncomingMsgHandler::RemoveHandler, XrdCl::InMessageHelper::Reset(), and XrdCl::Message::SetSessionId().
Referenced by XrdCl::AsyncSocketHandler::OnRead().
| void XrdCl::Stream::OnMessageSent | ( | uint16_t | subStream, |
| Message * | msg, | ||
| uint32_t | bytesSent | ||
| ) |
References XrdCl::OutMessageHelper::handler, XrdCl::OutgoingMsgHandler::OnStatusReady(), pBytesSent, and pSubStreams.
Referenced by XrdCl::AsyncSocketHandler::OnWrite().
| void XrdCl::Stream::OnReadTimeout | ( | uint16_t | subStream | ) |
On read timeout.
Referenced by XrdCl::AsyncSocketHandler::OnReadTimeout().
| std::pair< Message *, OutgoingMsgHandler * > 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().
| void XrdCl::Stream::SetChannelData | ( | AnyObject * | channelData | ) | [inline] |
Set the channel data.
References pChannelData.
| void XrdCl::Stream::SetIncomingQueue | ( | InQueue * | incomingQueue | ) | [inline] |
Set the incoming queue.
References pIncomingQueue, and pQueueIncMsgJob.
| void XrdCl::Stream::SetJobManager | ( | JobManager * | jobManager | ) | [inline] |
Set job manager.
References pJobManager.
| void XrdCl::Stream::SetPoller | ( | Poller * | poller | ) | [inline] |
Set the poller.
References pPoller.
| void XrdCl::Stream::SetTaskManager | ( | TaskManager * | taskManager | ) | [inline] |
Set task manager.
References pTaskManager.
| void XrdCl::Stream::SetTransport | ( | TransportHandler * | transport | ) | [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().
std::vector<sockaddr_in> XrdCl::Stream::pAddresses [private] |
Referenced by EnableLink(), and OnConnectError().
uint64_t XrdCl::Stream::pBytesReceived [private] |
Referenced by MonitorDisconnection(), OnConnect(), and OnIncoming().
uint64_t XrdCl::Stream::pBytesSent [private] |
Referenced by MonitorDisconnection(), OnConnect(), and OnMessageSent().
AnyObject* XrdCl::Stream::pChannelData [private] |
Referenced by Initialize(), OnConnect(), OnIncoming(), Send(), and SetChannelData().
Referenced by OnError(), OnFatalError(), RegisterEventHandler(), and RemoveEventHandler().
uint16_t XrdCl::Stream::pConnectionCount [private] |
Referenced by EnableLink(), OnConnect(), OnConnectError(), and OnFatalError().
timeval XrdCl::Stream::pConnectionDone [private] |
Referenced by MonitorDisconnection(), OnConnect(), and Stream().
time_t XrdCl::Stream::pConnectionInitTime [private] |
Referenced by EnableLink(), and OnConnectError().
uint16_t XrdCl::Stream::pConnectionRetry [private] |
Referenced by OnConnectError(), and Stream().
timeval XrdCl::Stream::pConnectionStarted [private] |
Referenced by EnableLink(), OnConnect(), and Stream().
uint16_t XrdCl::Stream::pConnectionWindow [private] |
Referenced by EnableLink(), OnConnect(), OnConnectError(), and Stream().
InQueue* XrdCl::Stream::pIncomingQueue [private] |
Referenced by InstallIncHandler(), OnError(), OnFatalError(), OnIncoming(), SetIncomingQueue(), and Tick().
JobManager* XrdCl::Stream::pJobManager [private] |
Referenced by OnIncoming(), and SetJobManager().
uint16_t XrdCl::Stream::pLastStreamError [private] |
Referenced by EnableLink(), OnConnect(), and OnFatalError().
XrdSysRecMutex XrdCl::Stream::pMutex [private] |
Referenced by EnableLink(), ForceConnect(), OnConnect(), OnConnectError(), OnError(), OnReadyToWrite(), Send(), and Tick().
Poller* XrdCl::Stream::pPoller [private] |
Referenced by Initialize(), OnConnect(), and SetPoller().
QueueIncMsgJob* XrdCl::Stream::pQueueIncMsgJob [private] |
Referenced by OnIncoming(), SetIncomingQueue(), and ~Stream().
uint64_t XrdCl::Stream::pSessionId [private] |
Referenced by OnConnect(), OnIncoming(), and Send().
uint16_t XrdCl::Stream::pStreamErrorWindow [private] |
Referenced by EnableLink(), and Stream().
std::string XrdCl::Stream::pStreamName [private] |
Referenced by EnableLink(), GetName(), OnConnect(), OnConnectError(), OnError(), OnFatalError(), OnIncoming(), Send(), Stream(), and ~Stream().
uint16_t XrdCl::Stream::pStreamNum [private] |
Referenced by GetStreamNumber(), OnError(), OnFatalError(), OnReadyToWrite(), Stream(), and Tick().
SubStreamList XrdCl::Stream::pSubStreams [private] |
Referenced by EnableLink(), ForceConnect(), Initialize(), InstallIncHandler(), OnConnect(), OnConnectError(), OnError(), OnFatalError(), OnIncoming(), OnMessageSent(), OnReadyToWrite(), Send(), Tick(), and ~Stream().
TaskManager* XrdCl::Stream::pTaskManager [private] |
Referenced by OnConnectError(), and SetTaskManager().
TransportHandler* XrdCl::Stream::pTransport [private] |
Referenced by Initialize(), OnConnect(), OnIncoming(), Send(), and SetTransport().
const URL* XrdCl::Stream::pUrl [private] |
Referenced by EnableLink(), GetURL(), MonitorDisconnection(), OnConnect(), and Stream().
1.7.6.1