#include <XrdClAsyncSocketHandler.hh>
Public Member Functions | |
| AsyncSocketHandler (const URL &url, Poller *poller, TransportHandler *transport, AnyObject *channelData, uint16_t subStreamNum, Stream *strm) | |
| Constructor. | |
| ~AsyncSocketHandler () | |
| Destructor. | |
| XRootDStatus | Close () |
| Close the connection. | |
| 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. | |
| 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 |
| std::unique_ptr< HandShakeData > | pHandShakeData |
| bool | pHandShakeDone |
| time_t | pHSWaitSeconds |
| time_t | pHSWaitStarted |
| time_t | pLastActivity |
| Poller * | pPoller |
| XRootDStatus | pReqConnResetError |
| XrdNetAddr | pSockAddr |
| Socket * | pSocket |
| Stream * | pStream |
| std::string | pStreamName |
| uint16_t | pSubStreamNum |
| uint16_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 ) |
Constructor.
Definition at line 35 of file XrdClAsyncSocketHandler.cc.
References XrdCl::DefaultTimeoutResolution, XrdCl::DefaultEnv::GetEnv(), XrdCl::Env::GetInt(), pChannelData, pConnectionStarted, pConnectionTimeout, pHandShakeDone, pHSWaitSeconds, pHSWaitStarted, pLastActivity, pPoller, pSocket, pStream, pStreamName, pSubStreamNum, pTimeoutResolution, pTlsHandShakeOngoing, pTransport, pUrl, and ToStreamName().
| XrdCl::AsyncSocketHandler::~AsyncSocketHandler | ( | ) |
Destructor.
Definition at line 69 of file XrdClAsyncSocketHandler.cc.
References Close(), and pSocket.
|
protected |
Definition at line 887 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.
Definition at line 187 of file XrdClAsyncSocketHandler.cc.
References XrdCl::AsyncSockMsg, XrdCl::Log::Debug(), XrdCl::DefaultEnv::GetLog(), pChannelData, 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 78 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, pHandShakeDone, pHSWaitSeconds, pHSWaitStarted, pLastActivity, pPoller, pReqConnResetError, pSockAddr, pSocket, pStreamName, pTimeoutResolution, pTlsHandShakeOngoing, XrdCl::Status::status, XrdCl::stFatal, and XrdCl::Status::ToString().
|
inline |
Disable uplink.
Definition at line 105 of file XrdClAsyncSocketHandler.hh.
References XrdCl::errPollerError, pPoller, pSocket, and XrdCl::stFatal.
Referenced by OnWrite(), and OnWriteWhileHandshaking().
|
protected |
Definition at line 797 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 95 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 211 of file XrdClAsyncSocketHandler.cc.
References EventRead(), EventWrite(), OnFault(), pReqConnResetError, and pSocket.
|
inlineprotected |
Definition at line 245 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 285 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 72 of file XrdClAsyncSocketHandler.hh.
References pSockAddr.
| std::string XrdCl::AsyncSocketHandler::GetHostName | ( | ) |
Get hostname.
Definition at line 929 of file XrdClAsyncSocketHandler.cc.
References pSockAddr.
| std::string XrdCl::AsyncSocketHandler::GetIpAddr | ( | ) |
Get IP address.
Definition at line 919 of file XrdClAsyncSocketHandler.cc.
References XrdNetAddrInfo::fmtAddr, XrdNetAddrInfo::noPort, and pSockAddr.
| std::string XrdCl::AsyncSocketHandler::GetIpStack | ( | ) | const |
Get the IP stack.
Definition at line 909 of file XrdClAsyncSocketHandler.cc.
References XrdNetAddrInfo::IPv6, and pSockAddr.
|
inline |
Get timestamp of last registered socket activity.
Definition at line 123 of file XrdClAsyncSocketHandler.hh.
References pLastActivity.
|
inline |
|
protected |
Definition at line 602 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 873 of file XrdClAsyncSocketHandler.cc.
References ServerResponse::body, XrdCl::Buffer::GetBuffer(), ServerResponse::hdr, kXR_wait, and ServerResponseHeader::status.
Referenced by HandleHandShake().
|
protected |
Definition at line 689 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 328 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 731 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 743 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 785 of file XrdClAsyncSocketHandler.cc.
References XrdCl::errSocketError, pStream, and XrdCl::stError.
Referenced by OnRead().
|
protected |
Definition at line 522 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 763 of file XrdClAsyncSocketHandler.cc.
References pStream, and pSubStreamNum.
Referenced by EventRead().
|
protected |
Definition at line 571 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 771 of file XrdClAsyncSocketHandler.cc.
References XrdCl::errSocketTimeout, OnFaultWhileHandshaking(), pConnectionStarted, pConnectionTimeout, and XrdCl::stError.
Referenced by EventRead(), and EventWrite().
|
inlineprotected |
Definition at line 825 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 430 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 755 of file XrdClAsyncSocketHandler.cc.
References pStream, and pSubStreamNum.
Referenced by EventWrite().
|
protected |
Definition at line 478 of file XrdClAsyncSocketHandler.cc.
References XrdCl::Status::code, DisableUplink(), hswriter, XrdCl::Status::IsOK(), OnFaultWhileHandshaking(), and XrdCl::suRetry.
Referenced by EventWrite().
|
protected |
Definition at line 840 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 200 of file XrdClAsyncSocketHandler.cc.
References XrdCl::URL::GetHostId().
Referenced by AsyncSocketHandler().
|
protected |
Definition at line 290 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), OnConnectionReturn(), and OnReadWhileHandshaking().
|
protected |
Definition at line 288 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), OnConnectionReturn(), OnWriteWhileHandshaking(), and SendHSMsg().
|
protected |
Definition at line 270 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Close(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), and OnTLSHandShake().
|
protected |
Definition at line 279 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), HandleHandShake(), and OnTimeoutWhileHandshaking().
|
protected |
Definition at line 280 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), HandleHandShake(), and OnTimeoutWhileHandshaking().
|
protected |
Definition at line 276 of file XrdClAsyncSocketHandler.hh.
Referenced by HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), OnTLSHandShake(), and SendHSMsg().
|
protected |
Definition at line 277 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), EventRead(), EventWrite(), and HandShakeNextStep().
|
protected |
Definition at line 283 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), CheckHSWait(), Connect(), EventRead(), EventWrite(), HandleHandShake(), and SendHSMsg().
|
protected |
Definition at line 282 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), CheckHSWait(), Connect(), and HandleHandShake().
|
protected |
Definition at line 281 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), EventRead(), EventWrite(), and GetLastActivity().
|
protected |
Definition at line 268 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Close(), Connect(), DisableUplink(), EnableUplink(), and OnConnectionReturn().
|
protected |
Definition at line 286 of file XrdClAsyncSocketHandler.hh.
|
protected |
Definition at line 275 of file XrdClAsyncSocketHandler.hh.
Referenced by Connect(), GetAddress(), GetHostName(), GetIpAddr(), GetIpStack(), and SetAddress().
|
protected |
Definition at line 274 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), ~AsyncSocketHandler(), Close(), Connect(), DisableUplink(), DoTlsHandShake(), EnableUplink(), Event(), EventWrite(), HandleHandShake(), HandShakeNextStep(), and OnConnectionReturn().
|
protected |
Definition at line 272 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), HandShakeNextStep(), OnConnectionReturn(), OnFault(), OnFaultWhileHandshaking(), OnHeaderCorruption(), OnReadTimeout(), OnWrite(), and OnWriteTimeout().
|
protected |
Definition at line 273 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), CheckHSWait(), Close(), Connect(), DoTlsHandShake(), GetStreamName(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), OnFault(), and OnFaultWhileHandshaking().
|
protected |
Definition at line 271 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Close(), HandShakeNextStep(), OnConnectionReturn(), OnFault(), OnFaultWhileHandshaking(), OnReadTimeout(), OnWrite(), and OnWriteTimeout().
|
protected |
Definition at line 278 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), EnableUplink(), and OnConnectionReturn().
|
protected |
Definition at line 285 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Connect(), DoTlsHandShake(), EventRead(), and EventWrite().
|
protected |
Definition at line 269 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), Close(), HandleHandShake(), HandShakeNextStep(), OnConnectionReturn(), and OnTLSHandShake().
|
protected |
Definition at line 284 of file XrdClAsyncSocketHandler.hh.
Referenced by AsyncSocketHandler(), and DoTlsHandShake().
|
protected |
Definition at line 291 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), and OnWrite().
|
protected |
Definition at line 289 of file XrdClAsyncSocketHandler.hh.
Referenced by HandShakeNextStep(), and OnRead().