Loading...
Searching...
No Matches
XrdSsiSessReal Class Reference

`#include <XrdSsiSessReal.hh>`

Inheritance diagram for XrdSsiSessReal:
Collaboration diagram for XrdSsiSessReal:

## Public Member Functions

| XrdSsiSessReal (XrdSsiServReal *servP, const char *sName, int uent, bool hold=false)
| ~XrdSsiSessReal ()
const char * | GetKey ()
uint32_t | GetSID ()
void | InitSession (XrdSsiServReal *servP, const char *sName, int uent, bool hold, bool newSID=false)
void | Lock ()
XrdSsiMutex * | MutexP ()
bool | Provision (XrdSsiRequest *reqP, const char *epURL)
bool | Run (XrdSsiRequest *reqP)
void | SetKey (const char *key)
void | TaskFinished (XrdSsiTaskReal *tP)
void | UnHold (bool cleanup=true)
void | UnLock ()
bool | Unprovision ()
int | XeqEvent (XrdCl::XRootDStatus *status, XrdCl::AnyObject **respP)
void | XeqEvFin ()
Public Member Functions inherited from XrdSsiEvent
| XrdSsiEvent ()
| ~XrdSsiEvent ()
void | AddEvent (XrdCl::XRootDStatus *st, XrdCl::AnyObject *resp)
void | ClrEvent ()
virtual void | DoIt ()
virtual void | HandleResponse (XrdCl::XRootDStatus *status, XrdCl::AnyObject *response)
Public Member Functions inherited from XrdJob
| XrdJob (const char *desc="")
virtual | ~XrdJob ()
Public Member Functions inherited from XrdCl::ResponseHandler
virtual | ~ResponseHandler ()
virtual void | HandleResponseWithHosts (XRootDStatus *status, AnyObject *response, HostList *hostList)

## Public Attributes

XrdCl::File | epFile
XrdSsiSessReal * | nextSess
Public Attributes inherited from XrdJob
const char * | Comment
XrdJob * | NextJob

## Additional Inherited Members

Static Public Member Functions inherited from XrdCl::ResponseHandler
static ResponseHandler * | Wrap (std::function< void(XRootDStatus &, AnyObject &)> func)
static ResponseHandler * | Wrap (std::function< void(XRootDStatus *, AnyObject *)> func)
Protected Attributes inherited from XrdSsiEvent
char | tident [24]

## Detailed Description

Definition at line 44 of file XrdSsiSessReal.hh.

## Constructor & Destructor Documentation

## XrdSsiSessReal()

XrdSsiSessReal::XrdSsiSessReal | ( | XrdSsiServReal * | servP,
|  | const char * | sName,
|  | int | uent,
|  | bool | hold = false )

inline

Definition at line 86 of file XrdSsiSessReal.hh.

: sessMutex(XrdSsiMutex::Recursive),
resKey(0), sessName(0), sessNode(0)
{InitSession(servP, sName, uent, hold, true);}
XrdSsiMutex::Recursive
@ Recursive
Definition XrdSsiAtomics.hh:119
XrdSsiSessReal::InitSession
void InitSession(XrdSsiServReal *servP, const char *sName, int uent, bool hold, bool newSID=false)
Definition XrdSsiSessReal.cc:143

References InitSession().

Here is the call graph for this function:

## ~XrdSsiSessReal()

XrdSsiSessReal::~XrdSsiSessReal | ( |  | ) |

Definition at line 128 of file XrdSsiSessReal.cc.

{
XrdSsiTaskReal *tP;
if (resKey) free(resKey);
if (sessName) free(sessName);
if (sessNode) free(sessNode);
while((tP = freeTask)) {freeTask = tP->attList.next; delete tP;}
}
XrdSsiTaskReal::attList
dlQ attList
Definition XrdSsiTaskReal.hh:104
XrdSsiTaskReal::dlQ::next
XrdSsiTaskReal * next
Definition XrdSsiTaskReal.hh:103

References XrdSsiTaskReal::attList, and XrdSsiTaskReal::dlQ::next.

## Member Function Documentation

## GetKey()

const char * XrdSsiSessReal::GetKey | ( |  | ) |

inline

Definition at line 50 of file XrdSsiSessReal.hh.

{return resKey;}

Referenced by XrdSsiServReal::Recycle().

Here is the caller graph for this function:

## GetSID()

uint32_t XrdSsiSessReal::GetSID | ( |  | ) |

inline

Definition at line 52 of file XrdSsiSessReal.hh.

{return sessID;}

Referenced by XrdSsiServReal::Recycle().

Here is the caller graph for this function:

## InitSession()

void XrdSsiSessReal::InitSession | ( | XrdSsiServReal * | servP,
|  | const char * | sName,
|  | int | uent,
|  | bool | hold,
|  | bool | newSID = false )

Definition at line 143 of file XrdSsiSessReal.cc.

{
EPNAME("InitSession");
requestP = 0;
uEnt = uent;
attBase = 0;
freeTask = 0;
myService = servP;
nextTID = 0;
alocLeft = XrdSsiRRInfo::idMax;
isHeld = hold;
inOpen = false;
noReuse = false;
if (resKey) {free(resKey); resKey = 0;}
if (sessName) free(sessName);
sessName = (sName ? strdup(sName) : 0);
if (sessNode) free(sessNode);
sessNode = 0;
if (newSID)
{if (servP == 0) sessID = 0xffffffff;
else {Atomic_BEG(sidMutex);
sessID = Atomic_INC(sidVal);
Atomic_END(sidMutex);
snprintf(tident, sizeof(tident), "S %u#", sessID);
DEBUG("new sess for "<<sName<<" uent="<<uent<<" hold="<<hold);
}
} else {
DEBUG("reuse sess for "<<sName<<" uent="<<uent<<" hold="<<hold);
}
}
DEBUG
#define DEBUG(x)
Definition XrdBwmTrace.hh:54
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
Atomic_INC
#define Atomic_INC(x)
Definition XrdSsiAtomics.hh:97
Atomic_END
#define Atomic_END(x)
Definition XrdSsiAtomics.hh:100
Atomic_BEG
#define Atomic_BEG(x)
Definition XrdSsiAtomics.hh:94
XrdSsiEvent::tident
char tident[24]
Definition XrdSsiEvent.hh:62
XrdSsiRRInfo::idMax
static const unsigned int idMax
Definition XrdSsiRRInfo.hh:41

References Atomic_BEG, Atomic_END, Atomic_INC, DEBUG, EPNAME, XrdSsiRRInfo::idMax, and XrdSsiEvent::tident.

Referenced by XrdSsiSessReal().

Here is the caller graph for this function:

## Lock()

void XrdSsiSessReal::Lock | ( |  | ) |

inline

Definition at line 60 of file XrdSsiSessReal.hh.

{sessMutex.Lock();}

## MutexP()

XrdSsiMutex * XrdSsiSessReal::MutexP | ( |  | ) |

inline

Definition at line 62 of file XrdSsiSessReal.hh.

{return &sessMutex;}

## Provision()

bool XrdSsiSessReal::Provision | ( | XrdSsiRequest * | reqP,
|  | const char * | epURL )

Definition at line 225 of file XrdSsiSessReal.cc.

{
EPNAME("Provision");
XrdCl::XRootDStatus epStatus;
XrdSsiMutexMon rHelp(&sessMutex);
XrdCl::OpenFlags::Flags oFlags = XrdCl::OpenFlags::Read;
// Set retry flag as appropriate
//
if (XrdSsiRRAgent::isaRetry(reqP, true)) oFlags |= XrdCl::OpenFlags::Refresh;
// Issue the open and if the open was started, return success.
//
DEBUG("Provisioning " <<epURL);
epStatus = epFile.Open((const std::string)epURL, oFlags,
(XrdCl::Access::Mode)0,
(XrdCl::ResponseHandler *)this,
reqP->GetTimeOut());
// If there was an error, scuttle the request. Note that errors will be returned
// on a separate thread to avoid hangs here.
//
if (!epStatus.IsOK())
{std::string eTxt;
int eNum = XrdSsiUtils::GetErr(epStatus, eTxt);
XrdSsiUtils::RetErr(*reqP, eTxt.c_str(), eNum);
XrdSsi::sidScale.retEnt(uEnt);
return false;
}
// Queue a new task and indicate our state
//
NewTask(reqP);
inOpen = true;
return true;
}
XrdSsiRRAgent::isaRetry
static bool isaRetry(XrdSsiRequest *rP, bool reset=false)
Definition XrdSsiRRAgent.hh:50
XrdSsiRequest::GetTimeOut
uint16_t GetTimeOut()
Definition XrdSsiRequest.hh:168
XrdSsiScale::retEnt
void retEnt(int xEnt)
Definition XrdSsiScale.cc:95
XrdSsiSessReal::epFile
XrdCl::File epFile
Definition XrdSsiSessReal.hh:96
XrdSsiUtils::GetErr
static int GetErr(XrdCl::XRootDStatus &Status, std::string &eText)
Definition XrdSsiUtils.cc:191
XrdSsiUtils::RetErr
static void RetErr(XrdSsiRequest &reqP, const char *eTxt, int eNum)
Definition XrdSsiUtils.cc:220
XrdSsi::sidScale
XrdSsiScale sidScale
Definition XrdSsiServReal.cc:52
XrdCl::Access::Mode
Mode
Access mode.
Definition XrdClFileSystem.hh:122
XrdCl::OpenFlags::Flags
Flags
Open flags, may be or'd when appropriate.
Definition XrdClFileSystem.hh:76
XrdCl::OpenFlags::Read
@ Read
Open only for reading.
Definition XrdClFileSystem.hh:95
XrdCl::OpenFlags::Refresh
@ Refresh
Definition XrdClFileSystem.hh:100
XrdCl::Status::IsOK
bool IsOK() const
We're fine.
Definition XrdClStatus.hh:124

References DEBUG, epFile, EPNAME, XrdSsiUtils::GetErr(), XrdSsiRequest::GetTimeOut(), XrdSsiRRAgent::isaRetry(), XrdCl::Status::IsOK(), XrdCl::OpenFlags::Read, XrdCl::OpenFlags::Refresh, XrdSsiUtils::RetErr(), and XrdSsi::sidScale.

Referenced by XrdSsiServReal::ProcessRequest().

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

## Run()

bool XrdSsiSessReal::Run | ( | XrdSsiRequest * | reqP | ) |

Definition at line 287 of file XrdSsiSessReal.cc.

{
XrdSsiMutexMon sessMon(sessMutex);
XrdSsiTaskReal *tP;
// If we are not allowed to be reused, return to indicated try someone else
//
if (noReuse) return false;
// Reserve a stream ID. If we cannot then indicate we cannot be reused
//
if (!XrdSsi::sidScale.rsvEnt(uEnt)) return false;
// Queue a new task
//
tP = NewTask(reqP);
// If we are already open and we have a task, send off the request
//
if (!inOpen && tP && !tP->SendRequest(sessNode)) noReuse = true;
return true;
}
XrdSsiTaskReal::SendRequest
bool SendRequest(const char *node)
Definition XrdSsiTaskReal.cc:434

References XrdSsiTaskReal::SendRequest(), and XrdSsi::sidScale.

Here is the call graph for this function:

## SetKey()

void XrdSsiSessReal::SetKey | ( | const char * | key | ) |

inline

Definition at line 68 of file XrdSsiSessReal.hh.

{if (resKey) free(resKey);
resKey = (key ? strdup(key) : 0);
}

Referenced by XrdSsiServReal::ProcessRequest().

Here is the caller graph for this function:

## TaskFinished()

void XrdSsiSessReal::TaskFinished | ( | XrdSsiTaskReal * | tP | ) |

Definition at line 348 of file XrdSsiSessReal.cc.

{
EPNAME("TaskFin");
// Lock our mutex
//
sessMutex.Lock();
// Remove task from the task list if it's in it and release the task object.
//
if (tP == attBase || tP->attList.next != tP)
{REMOVE(attBase, attList, tP);}
RelTask(tP);
// Return the request entry number
//
XrdSsi::sidScale.retEnt(uEnt);
// If we are waiting for a provision to finish, simply exit as the event
// handler will notice that there is no task and will unprovision. Otherwise
//
// If we can shutdown, then unprovision which will drive a shutdown. Note
// that Unprovision() returns without the sessMutex, otherwise we must
// unlock it before we return. A shutdown invalidates this object!
//
if (!inOpen)
{if (!isHeld && !attBase) Unprovision();
else sessMutex.UnLock();
} else {
DEBUG("Unprovision deferred for " <<sessName);
sessMutex.UnLock();
}
}
REMOVE
#define REMOVE(dlbase, dlvar, curitem)
Definition XrdSsiSessReal.cc:69
XrdSsiSessReal::Unprovision
bool Unprovision()
Definition XrdSsiSessReal.cc:408

References XrdSsiTaskReal::attList, DEBUG, EPNAME, XrdSsiTaskReal::dlQ::next, REMOVE, XrdSsi::sidScale, and Unprovision().

Here is the call graph for this function:

## UnHold()

void XrdSsiSessReal::UnHold | ( | bool | cleanup = true | ) |

Definition at line 387 of file XrdSsiSessReal.cc.

{
XrdSsiMutexMon sessMon(sessMutex);
// Immediately stopo reuse of this object
//
if (isHeld && resKey && myService) myService->StopReuse(resKey);
// Turn off the hold flag and if we have no attached tasks, schedule shutdown
//
isHeld = false;
if (cleanup && !attBase) XrdSsi::schedP->Schedule(new CleanUp(this));
}
XrdScheduler::Schedule
void Schedule(XrdJob *jp)
Definition XrdScheduler.cc:373
XrdSsi::schedP
XrdScheduler * schedP
Definition XrdSsiClient.cc:74

References XrdSsi::schedP.

## UnLock()

void XrdSsiSessReal::UnLock | ( |  | ) |

inline

Definition at line 77 of file XrdSsiSessReal.hh.

{sessMutex.UnLock();}

Referenced by XrdSsiServReal::Recycle().

Here is the caller graph for this function:

## Unprovision()

bool XrdSsiSessReal::Unprovision | ( |  | ) |

Definition at line 408 of file XrdSsiSessReal.cc.

{
EPNAME("Unprovision");
XrdCl::XRootDStatus uStat;
// Clear any pending events
//
DEBUG("Closing " <<sessName);
// If the file is not open (it might be due to an open error) then do a
// shutdown right away. Otherwise, try to close if successful the event
// handler will do the shutdown, Otherwise, we do a Futterwacken dance.
//
if (!epFile.IsOpen()) {Shutdown(uStat, false); return false;}
else {uStat = epFile.Close((XrdCl::ResponseHandler *)this);
if (!uStat.IsOK()) {Shutdown(uStat, true); return false;}
else sessMutex.UnLock();
}
return true;
}

References DEBUG, epFile, EPNAME, and XrdCl::Status::IsOK().

Referenced by TaskFinished(), and XeqEvent().

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

## XeqEvent()

int XrdSsiSessReal::XeqEvent | ( | XrdCl::XRootDStatus * | status,
|  | XrdCl::AnyObject ** | respP )

virtual

Implements XrdSsiEvent.

Definition at line 433 of file XrdSsiSessReal.cc.

{
// Lock out mutex. Note that events like shutdown unlock the mutex. The only
// events handled here are open() and close().
//
sessMutex.Lock();
XrdSsiTaskReal *ztP, *ntP, *tP = attBase;
// If we are not in the open phase then this is due to a close event. Simply
// do a shutdown and return to stop event processing.
//
if (!inOpen)
{Shutdown(*status, true); // sessMutex gets unlocked!
return -1; // This object no longer valid!
}
// We are no longer in open. However, if open encounetered an error then this
// session cannot be reused because the file object is in a bad state.
//
inOpen = false;
noReuse = !status->IsOK();
// If we have no requests then we may want to simply shoutdown.
// Note that shutdown and unprovision unlock the sessMutex.
//
if (!tP)
{if (isHeld)
{sessMutex.UnLock();
return 1;
}
if (!status->IsOK()) {Shutdown(*status, false); return -1;}
else {if (!isHeld) return (Unprovision() ? 1 : -1);
else sessMutex.UnLock();
}
return 1; // Flush events and continue
}
// We are here because the open finally completed. If the open failed, then
// schedule an error for all pending tasks. The Finish() call on each will
// drive the cleanup of this session.
//
if (!status->IsOK())
{XrdSsiErrInfo eInfo;
XrdSsiUtils::SetErr(*status, eInfo);
do {tP->SchedError(&eInfo); tP = tP->attList.next;}
while(tP != attBase);
sessMutex.UnLock();
return -1; // Halt processing as this object may now be deleted
}
// Obtain the endpoint name
//
std::string currNode;
if (epFile.GetProperty(dsProperty, currNode))
{if (sessNode) free(sessNode);
sessNode = strdup(currNode.c_str());
} else sessNode = strdup("Unknown!");
// Execute each pending request. Make sure not to reference the task object
// chain pointer after invoking SendRequest() as it may become invalid.
//
ztP = attBase;
do {ntP = tP->attList.next;
if (!tP->SendRequest(sessNode)) noReuse = true;
tP = ntP;
} while(tP != ztP);
// We are done, field the next event
//
sessMutex.UnLock();
return 0;
}
XrdSsiTaskReal::SchedError
void SchedError(XrdSsiErrInfo *eInfo=0)
Definition XrdSsiTaskReal.cc:372
XrdSsiUtils::SetErr
static void SetErr(XrdCl::XRootDStatus &Status, XrdSsiErrInfo &eInfo)
Definition XrdSsiUtils.cc:232

References XrdSsiTaskReal::attList, epFile, XrdCl::Status::IsOK(), XrdSsiTaskReal::dlQ::next, XrdSsiTaskReal::SchedError(), XrdSsiTaskReal::SendRequest(), XrdSsiUtils::SetErr(), and Unprovision().

Here is the call graph for this function:

## XeqEvFin()

void XrdSsiSessReal::XeqEvFin | ( |  | ) |

inline virtual

Implements XrdSsiEvent.

Definition at line 84 of file XrdSsiSessReal.hh.

{}

## Member Data Documentation

## epFile

XrdCl::File XrdSsiSessReal::epFile

Definition at line 96 of file XrdSsiSessReal.hh.

Referenced by Provision(), Unprovision(), and XeqEvent().

## nextSess

XrdSsiSessReal* XrdSsiSessReal::nextSess

Definition at line 48 of file XrdSsiSessReal.hh.

Referenced by XrdSsiServReal::~XrdSsiServReal(), and XrdSsiServReal::Recycle().

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

- XrdSsiSessReal.hh
- XrdSsiSessReal.cc