Loading...
Searching...
No Matches
XrdHttpTpc::PMarkManager Class Reference

`#include <XrdHttpTpcPMarkManager.hh>`

Collaboration diagram for XrdHttpTpc::PMarkManager:

## Classes

class | SocketInfo

## Public Member Functions

| PMarkManager (XrdHttpExtReq &req, const TPC::TpcType type)
virtual | ~PMarkManager ()=default
void | beginPMarks ()
bool | connect (int fd, const struct sockaddr *sockP, size_t sockPLen, uint32_t timeout_sec, std::stringstream &err)
void | endPmark (int fd)
bool | isEnabled () const
void | startTransfer ()

## Detailed Description

Definition at line 52 of file XrdHttpTpcPMarkManager.hh.

## Constructor & Destructor Documentation

## PMarkManager()

XrdHttpTpc::PMarkManager::PMarkManager | ( | XrdHttpExtReq & | req,
|  | const TPC::TpcType | type )

Definition at line 35 of file XrdHttpTpcPMarkManager.cc.

: mPmark(req.pmark), mReq(req), mTransferWillStart(false), mTpcType(tpcType) {}
XrdHttpExtReq::pmark
XrdNetPMark * pmark
Definition XrdHttpExtHandler.hh:60

## ~PMarkManager()

virtual XrdHttpTpc::PMarkManager::~PMarkManager | ( |  | ) |

virtual default

## Member Function Documentation

## beginPMarks()

void XrdHttpTpc::PMarkManager::beginPMarks | ( |  | ) |

Creates the different packet marking handles allowing to mark the transfer packets

Call this after the curl_multi_perform() has been called.

Definition at line 66 of file XrdHttpTpcPMarkManager.cc.

{
if(mSocketInfos.empty()) {
return;
}
if(mPmarkHandles.empty()) {
// Create the first pmark handle
std::stringstream ss;
ss << "scitag.flow=" << mReq.mSciTag
// One has to consider that this server is the client side of a normal HTTP PUT/GET. But unlike normal HTTP PUT and GET requests where clients
// do not emit a firefly, this server WILL emit a firefly.
//
// For PULL: it is expected that I send a GET request to the remote server
// however, it is myself who will emit the firefly, then I should consider that the GET is actually a PUT
// that I do on behalf of the remote server... Hence why if the tpc transfer type is Pull, the pmark.appname
// will be equal to http-put
//
// For PUSH: it is expected that I send a PUT request to the remote server.
// however, it is myself who will emit the firefly, then I should consider that the PUT is actually a GET
// that I do on behalf of the remote server... Hence why if the tpc transfer is Push, the pmark.appname will be equal to http-get.
<< "&" << "pmark.appname=" << ((mTpcType == TPC::TpcType::Pull) ? "http-put" : "http-get");
SocketInfo & sockInfo = mSocketInfos.front();
auto pmark = mPmark->Begin(sockInfo.client, mReq.resource.c_str(), ss.str().c_str(), "http-tpc");
if(!pmark) {
return;
}
mPmarkHandles.emplace(sockInfo.client.addrInfo->SockFD(),std::unique_ptr<XrdNetPMark::Handle>(pmark));
mSocketInfos.pop();
}
auto pmarkHandleItor = mPmarkHandles.begin();
while(!mSocketInfos.empty()) {
SocketInfo & sockInfo = mSocketInfos.front();
auto pmark = mPmark->Begin(*sockInfo.client.addrInfo, *(pmarkHandleItor->second), nullptr);
if (!pmark) {
// The packet marking handle could not be created from the first handle, let's retry next time
break;
}
int fd = sockInfo.client.addrInfo->SockFD();
mPmarkHandles.emplace(fd, std::unique_ptr<XrdNetPMark::Handle>(pmark));
mSocketInfos.pop();
}
}
XrdHttpTpc::PMarkManager::SocketInfo
Definition XrdHttpTpcPMarkManager.hh:62
XrdHttpTpc::PMarkManager::SocketInfo::client
XrdSecEntity client
Definition XrdHttpTpcPMarkManager.hh:66
XrdNetAddrInfo::SockFD
int SockFD()
Definition XrdNetAddrInfo.hh:297
XrdSecEntity::addrInfo
XrdNetAddrInfo * addrInfo
Entity's connection details.
Definition XrdSecEntity.hh:80
TPC::TpcType::Pull
@ Pull
Definition XrdHttpTpcTPC.hh:36

References XrdSecEntity::addrInfo, XrdHttpTpc::PMarkManager::SocketInfo::client, TPC::Pull, and XrdNetAddrInfo::SockFD().

Here is the call graph for this function:

## connect()

bool XrdHttpTpc::PMarkManager::connect | ( | int | fd,
|  | const struct sockaddr * | sockP,
|  | size_t | sockPLen,
|  | uint32_t | timeout_sec,
|  | std::stringstream & | err )

Will connect the socket attached to the file descriptor within a certain timeout and add the file descriptor to the. packet marking manager so packet marking can be done achieved later on If pmark is not enabled, this function will just return true without trying to connect (libcurl will perform the connection). False will be returned in case the connection could not have been done.

Parameters

  fd | the fd associated to the socket
  sockP | the connection information
  sockPLen | the length of the connection information
  timeout_sec | the timeout after which the connection is considered failed
  err | the error stream allowing to understand from where the issue comes from

Returns
  true if the connection could be established or if pmark is disabled, false otherwise

Definition at line 44 of file XrdHttpTpcPMarkManager.cc.

{
if(isEnabled()) {
// We only connect if the packet marking is enabled
bool couldConnect = XrdNetUtils::ConnectWithTimeout(fd,sockP,sockPLen,timeout_sec,err);
if(couldConnect) {
addFd(fd,sockP);
} else {
return false;
}
}
// If pmark is not enabled, we leave libcurl doing the connection
return true;
}
XrdHttpTpc::PMarkManager::isEnabled
bool isEnabled() const
Definition XrdHttpTpcPMarkManager.cc:58
XrdNetUtils::ConnectWithTimeout
static bool ConnectWithTimeout(int sockfd, const struct sockaddr *clientAddr, size_t clientAddrLen, uint32_t timeout_sec, std::stringstream &errMsg)
Definition XrdNetUtils.cc:981

References XrdNetUtils::ConnectWithTimeout(), and isEnabled().

Here is the call graph for this function:

## endPmark()

void XrdHttpTpc::PMarkManager::endPmark | ( | int | fd | ) |

This function deletes the PMark handle associated to the fd passed in parameter Use this before closing the associated socket! Otherwise the information contained in the firefly (e.g sent bytes or received bytes) will have values equal to 0.

Parameters

  fd | the fd of the socket to be closed

Definition at line 111 of file XrdHttpTpcPMarkManager.cc.

{
// We need to delete the PMark handle associated to the fd passed in parameter
// we just look for it and reset the unique_ptr to nullptr to trigger the PMark handle deletion
mPmarkHandles.erase(fd);
}

## isEnabled()

bool XrdHttpTpc::PMarkManager::isEnabled | ( |  | ) | const

Returns
  true if packet marking can happen i.e the packet marking is enabled in the configuration and a scitag was provided by the user.

Definition at line 58 of file XrdHttpTpcPMarkManager.cc.

{
return mPmark && (mReq.mSciTag >= 0);
}

Referenced by connect().

Here is the caller graph for this function:

## startTransfer()

void XrdHttpTpc::PMarkManager::startTransfer | ( |  | ) |

Calling this function will indicate that the connections that will happen will be related to the data transfer. The addFd(...) function will then register any socket that is created after this function will be called.

Definition at line 62 of file XrdHttpTpcPMarkManager.cc.

{
mTransferWillStart = true;
}

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

- XrdHttpTpcPMarkManager.hh
- XrdHttpTpcPMarkManager.cc