Loading...
Searching...
No Matches
XrdCl::Channel Class Reference

A communication channel between the client and the server. More...

`#include <XrdClChannel.hh>`

Collaboration diagram for XrdCl::Channel:

## Public Member Functions

| Channel (const URL &url, Poller *poller, TransportHandler *transport, TaskManager *taskManager, JobManager *jobManager, const URL &prefurl=URL())
| ~Channel ()
| Destructor.
bool | CanCollapse (const URL &url)
void | DecFileInstCnt ()
| Decrement file object instance count bound to this channel.
Status | ForceDisconnect ()
| Force disconnect of all streams.
Status | ForceDisconnect (bool hush)
| Force disconnect of all streams.
Status | ForceReconnect ()
| Force reconnect.
const URL & | GetURL () const
| Get the URL.
uint16_t | NbConnectedStrm ()
| Get the number of connected data streams.
Status | QueryTransport (uint16_t query, AnyObject &result)
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)
void | SetOnDataConnectHandler (std::shared_ptr< Job > &onConnJob)
| Set the on-connect handler for data streams.
void | Tick (time_t now)
| Handle a time event.

## Detailed Description

A communication channel between the client and the server.

Definition at line 48 of file XrdClChannel.hh.

## Constructor & Destructor Documentation

## Channel()

XrdCl::Channel::Channel | ( | const URL & | url,
|  | Poller * | poller,
|  | TransportHandler * | transport,
|  | TaskManager * | taskManager,
|  | JobManager * | jobManager,
|  | const URL & | prefurl = URL() )

Constructor

Parameters

  url | address of the server to connect to
  poller | poller object to be used for non-blocking IO
  transport | protocol specific transport handler
  taskManager | async task handler to be used by the channel
  jobManager | worker thread handler to be used by the channel

Definition at line 84 of file XrdClChannel.cc.

:
pUrl( url.GetHostId() ),
pPoller( poller ),
pTransport( transport ),
pTaskManager( taskManager ),
pTickGenerator( 0 ),
pJobManager( jobManager )
{
Env *env = DefaultEnv::GetEnv();
Log *log = DefaultEnv::GetLog();
int timeoutResolution = DefaultTimeoutResolution;
env->GetInt( "TimeoutResolution", timeoutResolution );
pTransport->InitializeChannel( url, pChannelData );
log->Debug( PostMasterMsg, "Creating new channel to: %s",
url.GetChannelId().c_str() );
pUrl.SetParams( url.GetParams() );
pUrl.SetProtocol( url.GetProtocol() );
//--------------------------------------------------------------------------
// Create the stream
//--------------------------------------------------------------------------
pStream = new Stream( &pUrl, prefurl );
pStream->SetTransport( transport );
pStream->SetPoller( poller );
pStream->SetIncomingQueue( &pIncoming );
pStream->SetTaskManager( taskManager );
pStream->SetJobManager( jobManager );
pStream->SetChannelData( &pChannelData );
pStream->Initialize();
//--------------------------------------------------------------------------
// Register the task generating timeout events
//--------------------------------------------------------------------------
pTickGenerator = new TickGeneratorTask( this, pUrl.GetChannelId() );
pTaskManager->RegisterTask( pTickGenerator, ::time(0)+timeoutResolution );
}
XrdCl::DefaultEnv::GetLog
static Log * GetLog()
Get default log.
Definition XrdClDefaultEnv.cc:493
XrdCl::DefaultEnv::GetEnv
static Env * GetEnv()
Get default client environment.
Definition XrdClDefaultEnv.cc:445
XrdCl::PostMasterMsg
const uint64_t PostMasterMsg
Definition XrdClConstants.hh:36
XrdCl::DefaultTimeoutResolution
const int DefaultTimeoutResolution
Definition XrdClConstants.hh:56
XrdGlobal::Log
XrdSysError Log
Definition XrdConfig.cc:113

References XrdCl::Log::Debug(), XrdCl::DefaultTimeoutResolution, XrdCl::URL::GetChannelId(), XrdCl::DefaultEnv::GetEnv(), XrdCl::Env::GetInt(), XrdCl::DefaultEnv::GetLog(), XrdCl::URL::GetParams(), XrdCl::URL::GetProtocol(), and XrdCl::PostMasterMsg.

Here is the call graph for this function:

## ~Channel()

XrdCl::Channel::~Channel | ( |  | ) |

Destructor.

Definition at line 132 of file XrdClChannel.cc.

{
pTickGenerator->Invalidate();
delete pStream;
pTransport->FinalizeChannel( pChannelData );
}

## Member Function Documentation

## CanCollapse()

bool XrdCl::Channel::CanCollapse | ( | const URL & | url | ) |

Returns
  : true if this channel can be collapsed using this URL, false otherwise

Definition at line 208 of file XrdClChannel.cc.

{
return pStream->CanCollapse( url );
}

Referenced by XrdCl::PostMaster::CollapseRedirect().

Here is the caller graph for this function:

## DecFileInstCnt()

void XrdCl::Channel::DecFileInstCnt | ( |  | ) |

Decrement file object instance count bound to this channel.

Definition at line 216 of file XrdClChannel.cc.

{
pTransport->DecFileInstCnt( pChannelData );
}

Referenced by XrdCl::PostMaster::DecFileInstCnt().

Here is the caller graph for this function:

## ForceDisconnect() [1/2]

Status XrdCl::Channel::ForceDisconnect | ( |  | ) |

Force disconnect of all streams.

Definition at line 162 of file XrdClChannel.cc.

{
return ForceDisconnect(false);
}
XrdCl::Channel::ForceDisconnect
Status ForceDisconnect()
Force disconnect of all streams.
Definition XrdClChannel.cc:162

References ForceDisconnect().

Referenced by ForceDisconnect(), and XrdCl::PostMaster::ForceDisconnect().

Here is the call graph for this function:
Here is the caller graph for this function:

## ForceDisconnect() [2/2]

Status XrdCl::Channel::ForceDisconnect | ( | bool | hush | ) |

Force disconnect of all streams.

Definition at line 170 of file XrdClChannel.cc.

{
//--------------------------------------------------------------------------
// Disconnect and recreate the streams
//--------------------------------------------------------------------------
pStream->ForceError( Status( stError, errOperationInterrupted ), hush );
return Status();
}
XrdCl::stError
const uint16_t stError
An error occurred that could potentially be retried.
Definition XrdClStatus.hh:32
XrdCl::errOperationInterrupted
const uint16_t errOperationInterrupted
Definition XrdClStatus.hh:91

References XrdCl::errOperationInterrupted, and XrdCl::stError.

## ForceReconnect()

Status XrdCl::Channel::ForceReconnect | ( |  | ) |

Force reconnect.

Definition at line 183 of file XrdClChannel.cc.

{
pStream->ForceConnect();
return Status();
}

## GetURL()

const URL & XrdCl::Channel::GetURL | ( |  | ) | const

inline

Get the URL.

Definition at line 75 of file XrdClChannel.hh.

{
return pUrl;
}

Referenced by XrdCl::PostMaster::CollapseRedirect().

Here is the caller graph for this function:

## NbConnectedStrm()

uint16_t XrdCl::Channel::NbConnectedStrm | ( |  | ) |

Get the number of connected data streams.

Definition at line 192 of file XrdClChannel.cc.

{
return XRootDTransport::NbConnectedStrm( pChannelData );
}
XrdCl::XRootDTransport::NbConnectedStrm
static uint16_t NbConnectedStrm(AnyObject &channelData)
Number of currently connected data streams.
Definition XrdClXRootDTransport.cc:1521

References XrdCl::XRootDTransport::NbConnectedStrm().

Referenced by XrdCl::PostMaster::NbConnectedStrm().

Here is the call graph for this function:
Here is the caller graph for this function:

## QueryTransport()

Status XrdCl::Channel::QueryTransport | ( | uint16_t | query,
|  | AnyObject & | result )

Query the transport handler

Parameters

  query | the query as defined in the TransportQuery struct or others that may be recognized by the protocol transport
  result | the result of the query

Returns
  status of the query

Definition at line 224 of file XrdClChannel.cc.

{
if( query < 2000 )
return pTransport->Query( query, result, pChannelData );
return pStream->Query( query, result );
}

Referenced by XrdCl::PostMaster::QueryTransport().

Here is the caller graph for this function:

## RegisterEventHandler()

void XrdCl::Channel::RegisterEventHandler | ( | ChannelEventHandler * | handler | ) |

Register channel event handler.

Definition at line 234 of file XrdClChannel.cc.

{
pStream->RegisterEventHandler( handler );
}

Referenced by XrdCl::PostMaster::RegisterEventHandler().

Here is the caller graph for this function:

## RemoveEventHandler()

void XrdCl::Channel::RemoveEventHandler | ( | ChannelEventHandler * | handler | ) |

Remove a channel event handler.

Definition at line 242 of file XrdClChannel.cc.

{
pStream->RemoveEventHandler( handler );
}

Referenced by XrdCl::PostMaster::RemoveEventHandler().

Here is the caller graph for this function:

## Send()

XRootDStatus XrdCl::Channel::Send | ( | Message * | msg,
|  | MsgHandler * | handler,
|  | bool | stateful,
|  | time_t | expires )

Send the message asynchronously - the message is inserted into the send queue and a listener is called when the message is successfully pushed through the wire or when the timeout elapses

Parameters

  msg | message to be sent
  handler | handler to be notified about the status
  stateful | physical stream disconnection causes an error
  expires | unix timestamp after which a failure is reported to the listener

Returns
  success if the message was successfully inserted into the send queues, failure otherwise

Definition at line 142 of file XrdClChannel.cc.

{
return pStream->Send( msg, handler, stateful, expires );
}

Referenced by XrdCl::PostMaster::Send().

Here is the caller graph for this function:

## SetOnDataConnectHandler()

void XrdCl::Channel::SetOnDataConnectHandler | ( | std::shared_ptr< Job > & | onConnJob | ) |

Set the on-connect handler for data streams.

Definition at line 200 of file XrdClChannel.cc.

{
pStream->SetOnDataConnectHandler( onConnJob );
}

Referenced by XrdCl::PostMaster::SetOnDataConnectHandler().

Here is the caller graph for this function:

## Tick()

void XrdCl::Channel::Tick | ( | time_t | now | ) |

Handle a time event.

Definition at line 154 of file XrdClChannel.cc.

{
pStream->Tick( now );
}

The documentation for this class was generated from the following files:

- XrdClChannel.hh
- XrdClChannel.cc