#include <XrdClAsyncSocketHandler.hh>
Public Member Functions | |
| AsyncSocketHandler (const AsyncSocketHandler &other) | |
| AsyncSocketHandler (const URL &url, Poller *poller, TransportHandler *transport, AnyObject *channelData, uint16_t subStreamNum, Stream *strm) | |
| Constructors. | |
| ~AsyncSocketHandler () | |
| Destructor. | |
| XRootDStatus | Close () |
| XRootDStatus | Connect (time_t timeout) |
| Connect to the currently set address. | |
| XRootDStatus | DisableUplink () |
| Disable uplink. | |
| XRootDStatus | EnableUplink () |
| Enable uplink. | |
| virtual void | Event (uint8_t type, XrdCl::Socket *) |
| Handle a socket event. | |
| const XrdNetAddr & | GetAddress () const |
| Get the address that the socket is connected to. | |
| std::string | GetHostName () |
| Get hostname. | |
| std::string | GetIpAddr () |
| Get IP address. | |
| std::string | GetIpStack () const |
| Get the IP stack. | |
| time_t | GetLastActivity () |
| Get timestamp of last registered socket activity. | |
| const std::string & | GetStreamName () |
| Get stream name. | |
| XRootDStatus | PreClose () |
| void | SetAddress (const XrdNetAddr &address) |
| Set address. | |
| Public Member Functions inherited from XrdCl::SocketHandler | |
| virtual | ~SocketHandler () |
| virtual void | Finalize () |
| Finalizer. | |
| virtual void | Initialize (Poller *) |
| Initializer. | |
Protected Member Functions | |
| bool | CheckHSWait () XRD_WARN_UNUSED_RESULT |
| XRootDStatus | DoTlsHandShake () |
| bool | EventRead (uint8_t type) XRD_WARN_UNUSED_RESULT |
| bool | EventWrite (uint8_t type) XRD_WARN_UNUSED_RESULT |
| bool | HandleHandShake (std::unique_ptr< Message > msg) XRD_WARN_UNUSED_RESULT |
| kXR_int32 | HandleWaitRsp (Message *rsp) |
| bool | HandShakeNextStep (bool done) XRD_WARN_UNUSED_RESULT |
| virtual bool | OnConnectionReturn () XRD_WARN_UNUSED_RESULT |
| void | OnFault (XRootDStatus st) |
| void | OnFaultWhileHandshaking (XRootDStatus st) |
| void | OnHeaderCorruption () |
| bool | OnRead () XRD_WARN_UNUSED_RESULT |
| bool | OnReadTimeout () XRD_WARN_UNUSED_RESULT |
| bool | OnReadWhileHandshaking () XRD_WARN_UNUSED_RESULT |
| bool | OnTimeoutWhileHandshaking () XRD_WARN_UNUSED_RESULT |
| bool | OnTLSHandShake () XRD_WARN_UNUSED_RESULT |
| bool | OnWrite () XRD_WARN_UNUSED_RESULT |
| bool | OnWriteTimeout () XRD_WARN_UNUSED_RESULT |
| bool | OnWriteWhileHandshaking () XRD_WARN_UNUSED_RESULT |
| bool | SendHSMsg () XRD_WARN_UNUSED_RESULT |
Static Protected Member Functions | |
| static std::string | ToStreamName (const URL &url, uint16_t strmnb) |
| Convert Stream object and sub-stream number to stream name. | |
Protected Attributes | |
| std::unique_ptr< AsyncHSReader > | hsreader |
| std::unique_ptr< AsyncHSWriter > | hswriter |
| AnyObject * | pChannelData |
| time_t | pConnectionStarted |
| time_t | pConnectionTimeout |
| bool | pDoTransportDisc |
| std::unique_ptr< HandShakeData > | pHandShakeData |
| bool | pHandShakeDone |
| time_t | pHSWaitSeconds |
| time_t | pHSWaitStarted |
| time_t | pLastActivity |
| std::shared_ptr< Channel > | pOpenChannel |
| Poller * | pPoller |
| XRootDStatus | pReqConnResetError |
| XrdNetAddr | pSockAddr |
| Socket * | pSocket |
| Stream * | pStream |
| std::string | pStreamName |
| uint16_t | pSubStreamNum |
| time_t | pTimeoutResolution |
| bool | pTlsHandShakeOngoing |
| TransportHandler * | pTransport |
| URL | pUrl |
| std::unique_ptr< AsyncMsgWriter > | reqwriter |
| std::unique_ptr< AsyncMsgReader > | rspreader |
Additional Inherited Members | |
| Public Types inherited from XrdCl::SocketHandler | |
| enum | EventType { ReadyToRead = 0x01 , ReadTimeOut = 0x02 , ReadyToWrite = 0x04 , WriteTimeOut = 0x08 } |
| Event type. More... | |
| Static Public Member Functions inherited from XrdCl::SocketHandler | |
| static std::string | EventTypeToString (uint8_t event) |
| Translate the event type to a string. | |
Utility class handling asynchronous socket interactions and forwarding events to the parent stream.
Definition at line 43 of file XrdClAsyncSocketHandler.hh.
| XrdCl::AsyncSocketHandler::AsyncSocketHandler | ( | const URL & | url, |
| Poller * | poller, | ||
| TransportHandler * | transport, | ||
| AnyObject * | channelData, | ||
| uint16_t | subStreamNum, | ||
| Stream * | strm ) |
Constructors.
Definition at line 35 of file XrdClAsyncSocketHandler.cc.
References XrdCl::DefaultTimeoutResolution, XrdCl::DefaultEnv::GetEnv(), XrdCl::Env::GetInt(), pChannelData, pConnectionStarted, pConnectionTimeout, pDoTransportDisc, pHandShakeDone, pHSWaitSeconds, pHSWaitStarted, pLastActivity, pPoller, pSocket, pStream, pStreamName, pSubStreamNum, pTimeoutResolution, pTlsHandShakeOngoing, pTransport, pUrl, and ToStreamName().
Referenced by AsyncSocketHandler().
|
inline |
Definition at line 56 of file XrdClAsyncSocketHandler.hh.
References AsyncSocketHandler(), pChannelData, pLastActivity, pPoller, pStream, pSubStreamNum, pTransport, and pUrl.
| XrdCl::AsyncSocketHandler::~AsyncSocketHandler | ( | ) |
Destructor.
Definition at line 70 of file XrdClAsyncSocketHandler.cc.
References Close(), and pSocket.
|
protected |
Definition at line 926 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), pHSWaitSeconds, pHSWaitStarted, pStreamName, and SendHSMsg().
Referenced by EventRead().
| XRootDStatus XrdCl::AsyncSocketHandler::Close | ( | ) |
Close the connection. Can block until the poller can remove the socket, which may require waiting for dispatch of all queued events to all other sockets the poller thread is serving.
Definition at line 216 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), pChannelData, pDoTransportDisc, pOpenChannel, pPoller, pSocket, pStreamName, pSubStreamNum, and pTransport.
Referenced by ~AsyncSocketHandler().
| XRootDStatus XrdCl::AsyncSocketHandler::Connect | ( | time_t | timeout | ) |
Connect to the currently set address.
Definition at line 79 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Socket::Connecting, XrdCl::Log::Debug(), XrdCl::DefaultTCPKeepAlive, XrdCl::DefaultTCPKeepAliveInterval, XrdCl::DefaultTCPKeepAliveProbes, XrdCl::DefaultTCPKeepAliveTime, XrdCl::Log::Error(), XrdCl::errPollerError, XrdNetAddrInfo::fmtAdv6, XrdCl::DefaultEnv::GetEnv(), XrdCl::Env::GetInt(), XrdCl::DefaultEnv::GetLog(), XrdCl::Status::IsOK(), pConnectionStarted, pConnectionTimeout, pDoTransportDisc, pHandShakeDone, pHSWaitSeconds, pHSWaitStarted, pLastActivity, pOpenChannel, pPoller, pReqConnResetError, pSockAddr, pSocket, pStream, pStreamName, pTimeoutResolution, pTlsHandShakeOngoing, XrdCl::Status::status, XrdCl::stFatal, and XrdCl::Status::ToString().
|
inline |
Disable uplink.
Definition at line 122 of file XrdClAsyncSocketHandler.hh.
References XrdCl::errPollerError, pPoller, pSocket, and XrdCl::stFatal.
Referenced by OnWrite(), and OnWriteWhileHandshaking().
|
protected |
Definition at line 836 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Status::code, XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), XrdCl::Log::Info(), OnFaultWhileHandshaking(), pSocket, pStreamName, pTlsHandShakeOngoing, pUrl, and XrdCl::suRetry.
Referenced by HandleHandShake(), and OnTLSHandShake().
|
inline |
Enable uplink.
Definition at line 112 of file XrdClAsyncSocketHandler.hh.
References XrdCl::errPollerError, pPoller, pSocket, pTimeoutResolution, and XrdCl::stFatal.
Referenced by HandShakeNextStep(), and SendHSMsg().
|
virtual |
Handle a socket event.
Implements XrdCl::SocketHandler.
Definition at line 250 of file XrdClAsyncSocketHandler.cc.
References EventRead(), EventWrite(), OnFault(), pReqConnResetError, and pSocket.
|
inlineprotected |
Definition at line 284 of file XrdClAsyncSocketHandler.cc.
References CheckHSWait(), likely, OnRead(), OnReadTimeout(), OnReadWhileHandshaking(), OnTimeoutWhileHandshaking(), OnTLSHandShake(), pHandShakeDone, pHSWaitSeconds, pLastActivity, pTlsHandShakeOngoing, XrdCl::SocketHandler::ReadTimeOut, XrdCl::SocketHandler::ReadyToRead, and unlikely.
Referenced by Event().
|
inlineprotected |
Definition at line 324 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Socket::Connecting, likely, OnConnectionReturn(), OnTimeoutWhileHandshaking(), OnTLSHandShake(), OnWrite(), OnWriteTimeout(), OnWriteWhileHandshaking(), pHandShakeDone, pHSWaitSeconds, pLastActivity, pSocket, pTlsHandShakeOngoing, XrdCl::SocketHandler::ReadyToWrite, unlikely, and XrdCl::SocketHandler::WriteTimeOut.
Referenced by Event().
|
inline |
Get the address that the socket is connected to.
Definition at line 80 of file XrdClAsyncSocketHandler.hh.
References pSockAddr.
| std::string XrdCl::AsyncSocketHandler::GetHostName | ( | ) |
Get hostname.
Definition at line 968 of file XrdClAsyncSocketHandler.cc.
References pSockAddr.
| std::string XrdCl::AsyncSocketHandler::GetIpAddr | ( | ) |
Get IP address.
Definition at line 958 of file XrdClAsyncSocketHandler.cc.
References XrdNetAddrInfo::fmtAddr, XrdNetAddrInfo::noPort, and pSockAddr.
| std::string XrdCl::AsyncSocketHandler::GetIpStack | ( | ) | const |
Get the IP stack.
Definition at line 948 of file XrdClAsyncSocketHandler.cc.
References XrdNetAddrInfo::IPv6, and pSockAddr.
|
inline |
Get timestamp of last registered socket activity.
Definition at line 140 of file XrdClAsyncSocketHandler.hh.
References pLastActivity.
|
inline |
|
protected |
Definition at line 641 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Status::code, XrdCl::Log::Debug(), DoTlsHandShake(), XrdCl::Log::Error(), XrdCl::errSocketTimeout, XrdCl::DefaultEnv::GetLog(), HandleWaitRsp(), HandShakeNextStep(), XrdCl::Status::IsOK(), OnFaultWhileHandshaking(), pChannelData, pConnectionStarted, pConnectionTimeout, pHandShakeData, pHSWaitSeconds, pHSWaitStarted, pSocket, pStreamName, pTransport, SendHSMsg(), XrdCl::stError, XrdCl::suDone, and XrdCl::suRetry.
Referenced by OnReadWhileHandshaking().
Definition at line 912 of file XrdClAsyncSocketHandler.cc.
References ServerResponse::body, XrdCl::Buffer::GetBuffer(), ServerResponse::hdr, kXR_wait, and ServerResponseHeader::status.
Referenced by HandleHandShake().
|
protected |
Definition at line 728 of file XrdClAsyncSocketHandler.cc.
References EnableUplink(), hsreader, hswriter, OnFaultWhileHandshaking(), pChannelData, pHandShakeData, pHandShakeDone, pSocket, pStream, pStreamName, pSubStreamNum, pTransport, reqwriter, rspreader, and SendHSMsg().
Referenced by HandleHandShake(), and OnTLSHandShake().
|
protectedvirtual |
Definition at line 367 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Status::code, XrdCl::Socket::Connected, XrdCl::Log::Debug(), XrdCl::errConnectionError, XrdCl::Log::Error(), XrdCl::errPollerError, XrdCl::errSocketOptError, XrdCl::DefaultEnv::GetLog(), hsreader, hswriter, XrdCl::Status::IsOK(), pChannelData, pHandShakeData, pPoller, pSocket, pStream, pStreamName, pSubStreamNum, pTimeoutResolution, pTransport, XrdCl::stError, XrdCl::stFatal, XrdCl::suRetry, and XrdSysE2T().
Referenced by EventWrite().
|
protected |
Definition at line 770 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Log::Error(), XrdCl::DefaultEnv::GetLog(), pStream, pStreamName, pSubStreamNum, and XrdCl::Status::ToString().
Referenced by Event(), OnRead(), OnReadWhileHandshaking(), and OnWrite().
|
protected |
Definition at line 782 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Log::Error(), XrdCl::DefaultEnv::GetLog(), pStream, pStreamName, pSubStreamNum, and XrdCl::Status::ToString().
Referenced by DoTlsHandShake(), HandleHandShake(), HandShakeNextStep(), OnReadWhileHandshaking(), OnTimeoutWhileHandshaking(), OnWriteWhileHandshaking(), and SendHSMsg().
|
protected |
Definition at line 824 of file XrdClAsyncSocketHandler.cc.
References XrdCl::errSocketError, pStream, and XrdCl::stError.
Referenced by OnRead().
|
protected |
Definition at line 561 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Status::code, XrdCl::errCorruptedHeader, XrdCl::errInternal, XrdCl::Status::IsOK(), OnFault(), OnHeaderCorruption(), rspreader, XrdCl::stError, and XrdCl::suRetry.
Referenced by EventRead().
|
protected |
Definition at line 802 of file XrdClAsyncSocketHandler.cc.
References pStream, and pSubStreamNum.
Referenced by EventRead().
|
protected |
Definition at line 610 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Status::code, XrdCl::errInternal, HandleHandShake(), hsreader, XrdCl::Status::IsOK(), OnFault(), OnFaultWhileHandshaking(), XrdCl::stError, and XrdCl::suDone.
Referenced by EventRead().
|
protected |
Definition at line 810 of file XrdClAsyncSocketHandler.cc.
References XrdCl::errSocketTimeout, OnFaultWhileHandshaking(), pConnectionStarted, pConnectionTimeout, and XrdCl::stError.
Referenced by EventRead(), and EventWrite().
|
inlineprotected |
Definition at line 864 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Status::code, DoTlsHandShake(), HandShakeNextStep(), XrdCl::Status::IsOK(), pChannelData, pHandShakeData, pTransport, and XrdCl::suRetry.
Referenced by EventRead(), and EventWrite().
|
protected |
Definition at line 469 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Status::code, DisableUplink(), XrdCl::errInternal, XrdCl::Status::errNo, XrdCl::errSocketError, XrdCl::Status::IsOK(), OnFault(), pReqConnResetError, pStream, pSubStreamNum, reqwriter, XrdCl::stError, XrdCl::stOK, and XrdCl::suRetry.
Referenced by EventWrite().
|
protected |
Definition at line 794 of file XrdClAsyncSocketHandler.cc.
References pStream, and pSubStreamNum.
Referenced by EventWrite().
|
protected |
Definition at line 517 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Status::code, DisableUplink(), hswriter, XrdCl::Status::IsOK(), OnFaultWhileHandshaking(), and XrdCl::suRetry.
Referenced by EventWrite().
| XRootDStatus XrdCl::AsyncSocketHandler::PreClose | ( | ) |
Disable further event callbacks and performs close action on the transport. Will block until any currently running callback for this socket completes, unless called from within the callback itself.
Definition at line 196 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), pChannelData, pDoTransportDisc, pPoller, pSocket, pStreamName, pSubStreamNum, and pTransport.
|
protected |
Definition at line 879 of file XrdClAsyncSocketHandler.cc.
References EnableUplink(), XrdCl::errInternal, hswriter, OnFaultWhileHandshaking(), pHandShakeData, pHSWaitSeconds, and XrdCl::stError.
Referenced by CheckHSWait(), HandleHandShake(), and HandShakeNextStep().
|
inline |
|
staticprotected |
Convert Stream object and sub-stream number to stream name.
Definition at line 239 of file XrdClAsyncSocketHandler.cc.
References XrdCl::URL::GetHostId().
Referenced by AsyncSocketHandler().
|
protected |
Definition at line 308 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), OnConnectionReturn(), and OnReadWhileHandshaking().
|
protected |
Definition at line 306 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), OnConnectionReturn(), OnWriteWhileHandshaking(), and SendHSMsg().
|
protected |
Definition at line 287 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), Close(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), OnTLSHandShake(), and PreClose().
|
protected |
Definition at line 296 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), HandleHandShake(), and OnTimeoutWhileHandshaking().
|
protected |
Definition at line 297 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), HandleHandShake(), and OnTimeoutWhileHandshaking().
|
protected |
Definition at line 304 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Close(), Connect(), and PreClose().
|
protected |
Definition at line 293 of file XrdClAsyncSocketHandler.hh.
Referenced by HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), OnTLSHandShake(), and SendHSMsg().
|
protected |
Definition at line 294 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), EventRead(), EventWrite(), and HandShakeNextStep().
|
protected |
Definition at line 300 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), CheckHSWait(), Connect(), EventRead(), EventWrite(), HandleHandShake(), and SendHSMsg().
|
protected |
Definition at line 299 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), CheckHSWait(), Connect(), and HandleHandShake().
|
protected |
Definition at line 298 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), Connect(), EventRead(), EventWrite(), and GetLastActivity().
|
protected |
Definition at line 311 of file XrdClAsyncSocketHandler.hh.
|
protected |
Definition at line 285 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), Close(), Connect(), DisableUplink(), EnableUplink(), OnConnectionReturn(), and PreClose().
|
protected |
Definition at line 303 of file XrdClAsyncSocketHandler.hh.
|
protected |
Definition at line 292 of file XrdClAsyncSocketHandler.hh.
Referenced by Connect(), GetAddress(), GetHostName(), GetIpAddr(), GetIpStack(), and SetAddress().
|
protected |
Definition at line 291 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), ~AsyncSocketHandler(), Close(), Connect(), DisableUplink(), DoTlsHandShake(), EnableUplink(), Event(), EventWrite(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), and PreClose().
|
protected |
Definition at line 289 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), Connect(), HandShakeNextStep(), OnConnectionReturn(), OnFault(), OnFaultWhileHandshaking(), OnHeaderCorruption(), OnReadTimeout(), OnWrite(), and OnWriteTimeout().
|
protected |
Definition at line 290 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), CheckHSWait(), Close(), Connect(), DoTlsHandShake(), GetStreamName(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), OnFault(), OnFaultWhileHandshaking(), and PreClose().
|
protected |
Definition at line 288 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), Close(), HandShakeNextStep(), OnConnectionReturn(), OnFault(), OnFaultWhileHandshaking(), OnReadTimeout(), OnWrite(), OnWriteTimeout(), and PreClose().
|
protected |
Definition at line 295 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), EnableUplink(), and OnConnectionReturn().
|
protected |
Definition at line 302 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), DoTlsHandShake(), EventRead(), and EventWrite().
|
protected |
Definition at line 286 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), Close(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), OnTLSHandShake(), and PreClose().
|
protected |
Definition at line 301 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), AsyncSocketHandler(), and DoTlsHandShake().
|
protected |
Definition at line 309 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), and OnWrite().
|
protected |
Definition at line 307 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), and OnRead().