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

Utility class encapsulating writing hand-shake request logic. More...

`#include <XrdClAsyncHSWriter.hh>`

Collaboration diagram for XrdCl::AsyncHSWriter:

## Public Member Functions

| AsyncHSWriter (Socket &socket, const std::string &strmname)
bool | HasMsg ()
| Check if writer was assigned with a message.
void | Replay ()
| Replay the message that has been sent.
void | Reset (Message *msg=nullptr)
| Reset the state of the object (makes it ready to read out next msg).
XRootDStatus | Write ()
| Write the request into the socket.

## Detailed Description

Utility class encapsulating writing hand-shake request logic.

Definition at line 38 of file XrdClAsyncHSWriter.hh.

## Constructor & Destructor Documentation

## AsyncHSWriter()

XrdCl::AsyncHSWriter::AsyncHSWriter | ( | Socket & | socket,
|  | const std::string & | strmname )

inline

Constructor

Parameters

  socket | : the socket with the message to be read out
  strmname | : stream name

Definition at line 47 of file XrdClAsyncHSWriter.hh.

: writestage( WriteRequest ),
socket( socket ),
strmname( strmname ),
outmsg( nullptr )
{
}

## Member Function Documentation

## HasMsg()

bool XrdCl::AsyncHSWriter::HasMsg | ( |  | ) |

inline

Check if writer was assigned with a message.

Definition at line 77 of file XrdClAsyncHSWriter.hh.

{
return bool( outmsg );
}

## Replay()

void XrdCl::AsyncHSWriter::Replay | ( |  | ) |

inline

Replay the message that has been sent.

Definition at line 67 of file XrdClAsyncHSWriter.hh.

{
if( !outmsg ) return;
writestage = WriteRequest;
outmsg->SetCursor( 0 );
}

## Reset()

void XrdCl::AsyncHSWriter::Reset | ( | Message * | msg = nullptr | ) |

inline

Reset the state of the object (makes it ready to read out next msg).

Definition at line 58 of file XrdClAsyncHSWriter.hh.

{
writestage = WriteRequest;
outmsg.reset( msg );
}

## Write()

XRootDStatus XrdCl::AsyncHSWriter::Write | ( |  | ) |

inline

Write the request into the socket.

Definition at line 85 of file XrdClAsyncHSWriter.hh.

{
Log *log = DefaultEnv::GetLog();
while( true )
{
switch( writestage )
{
case WriteRequest:
{
XRootDStatus st = socket.Send( *outmsg, strmname );
if( !st.IsOK() || st.code == suRetry ) return st;
//----------------------------------------------------------------
// The next step is to write the signature
//----------------------------------------------------------------
writestage = WriteDone;
continue;
}
case WriteDone:
{
XRootDStatus st = socket.Flash();
if( !st.IsOK() )
{
log->Error( AsyncSockMsg, "[%s] Unable to flash the socket: %s",
strmname.c_str(), XrdSysE2T( st.errNo ) );
}
return st;
}
}
// just in case ...
break;
}
//----------------------------------------------------------------------
// We are done
//----------------------------------------------------------------------
return XRootDStatus();
}
XrdSysE2T
const char * XrdSysE2T(int errcode)
Definition XrdSysE2T.cc:104
XrdCl::DefaultEnv::GetLog
static Log * GetLog()
Get default log.
Definition XrdClDefaultEnv.cc:493
XrdCl::suRetry
const uint16_t suRetry
Definition XrdClStatus.hh:40
XrdCl::AsyncSockMsg
const uint64_t AsyncSockMsg
Definition XrdClConstants.hh:41
XrdGlobal::Log
XrdSysError Log
Definition XrdConfig.cc:113

References XrdCl::AsyncSockMsg, XrdCl::Status::code, XrdCl::Status::errNo, XrdCl::Log::Error(), XrdCl::DefaultEnv::GetLog(), XrdCl::Status::IsOK(), XrdCl::suRetry, and XrdSysE2T().

Here is the call graph for this function:

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

- XrdClAsyncHSWriter.hh