Loading...
Searching...
No Matches
XrdSsiFileReq Class Reference

`#include <XrdSsiFileReq.hh>`

Inheritance diagram for XrdSsiFileReq:
Collaboration diagram for XrdSsiFileReq:

## Public Types

enum | reqState { wtReq =0 , xqReq , wtRsp , doRsp , odRsp , erRsp , rsEnd }
enum | rspState { isNew =0 , isBegun , isBound , isAbort , isDone , isMax }

## Public Member Functions

| XrdSsiFileReq (const char *cID=0)
virtual | ~XrdSsiFileReq ()
void | Activate (XrdOucBuffer *oP, XrdSfsXioHandle bR, int rSz)
void | Alert (XrdSsiRespInfoMsg &aMsg)
| Send or receive a server generated alert.
void | DeferredFinalize ()
void | DoIt ()
void | Done (int &Result, XrdOucErrInfo *cbInfo, const char *path=0)
void | Finalize ()
bool | Finished (bool cancel=false)
void | Finished (XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false)
char * | GetRequest (int &rLen)
bool | ProcessResponse (const XrdSsiErrInfo &eInfo, const XrdSsiRespInfo &resp)
XrdSfsXferSize | Read (bool &done, char *buffer, XrdSfsXferSize blen)
void | RelRequestBuffer ()
int | Same (unsigned long long arg1, unsigned long long arg2)
int | Send (XrdSfsDio *sfDio, XrdSfsXferSize size)
bool | WantResponse (XrdOucErrInfo &eInfo)
Public Member Functions inherited from XrdSsiRequest
| XrdSsiRequest (const char *reqid=0, uint16_t tmo=0)
bool | Finished (bool cancel=false)
uint32_t | GetDetachTTL ()
std::string | GetEndPoint ()
const char * | GetMetadata (int &dlen)
const char * | GetRequestID ()
void | GetResponseData (char *buff, int blen)
uint16_t | GetTimeOut ()
virtual void | ProcessResponseData (const XrdSsiErrInfo &eInfo, char *buff, int blen, bool last)
void | ReleaseRequestBuffer ()
Public Member Functions inherited from XrdOucEICB
| XrdOucEICB ()
| Constructor and destructor.
virtual | ~XrdOucEICB ()
Public Member Functions inherited from XrdJob
| XrdJob (const char *desc="")
virtual | ~XrdJob ()

## Static Public Member Functions

static XrdSsiFileReq * | Alloc (XrdOucErrInfo *eP, XrdSsiFileResource *rP, XrdSsiFileSess *fP, const char *sn, const char *id, unsigned int rnum)
static void | SetMax (int mVal)

## Additional Inherited Members

Public Attributes inherited from XrdJob
const char * | Comment
XrdJob * | NextJob
Protected Member Functions inherited from XrdSsiRequest
virtual | ~XrdSsiRequest ()
void | SetDetachTTL (uint32_t dttl)
| Set the detached request time to live value.
void | SetRetry (bool onoff)
void | SetTimeOut (uint16_t tmo)

## Detailed Description

Definition at line 53 of file XrdSsiFileReq.hh.

## Member Enumeration Documentation

## reqState

enum XrdSsiFileReq::reqState

Enumerator
wtReq |
xqReq |
wtRsp |
doRsp |
odRsp |
erRsp |
rsEnd |

Definition at line 114 of file XrdSsiFileReq.hh.

{wtReq=0, xqReq, wtRsp, doRsp, odRsp, erRsp, rsEnd};
XrdSsiFileReq::doRsp
@ doRsp
Definition XrdSsiFileReq.hh:114
XrdSsiFileReq::erRsp
@ erRsp
Definition XrdSsiFileReq.hh:114
XrdSsiFileReq::wtReq
@ wtReq
Definition XrdSsiFileReq.hh:114
XrdSsiFileReq::odRsp
@ odRsp
Definition XrdSsiFileReq.hh:114
XrdSsiFileReq::wtRsp
@ wtRsp
Definition XrdSsiFileReq.hh:114
XrdSsiFileReq::rsEnd
@ rsEnd
Definition XrdSsiFileReq.hh:114
XrdSsiFileReq::xqReq
@ xqReq
Definition XrdSsiFileReq.hh:114

## rspState

enum XrdSsiFileReq::rspState

Enumerator
isNew |
isBegun |
isBound |
isAbort |
isDone |
isMax |

Definition at line 115 of file XrdSsiFileReq.hh.

{isNew=0, isBegun, isBound, isAbort, isDone, isMax};
XrdSsiFileReq::isNew
@ isNew
Definition XrdSsiFileReq.hh:115
XrdSsiFileReq::isBound
@ isBound
Definition XrdSsiFileReq.hh:115
XrdSsiFileReq::isAbort
@ isAbort
Definition XrdSsiFileReq.hh:115
XrdSsiFileReq::isBegun
@ isBegun
Definition XrdSsiFileReq.hh:115
XrdSsiFileReq::isDone
@ isDone
Definition XrdSsiFileReq.hh:115
XrdSsiFileReq::isMax
@ isMax
Definition XrdSsiFileReq.hh:115

## Constructor & Destructor Documentation

## XrdSsiFileReq()

XrdSsiFileReq::XrdSsiFileReq | ( | const char * | cID = 0 | ) |

inline

Definition at line 108 of file XrdSsiFileReq.hh.

: frqMutex(XrdSsiMutex::Recursive)
{Init(cID);}
XrdSsiMutex::Recursive
@ Recursive
Definition XrdSsiAtomics.hh:119

Referenced by Alloc().

Here is the caller graph for this function:

## ~XrdSsiFileReq()

virtual XrdSsiFileReq::~XrdSsiFileReq | ( |  | ) |

inline virtual

Definition at line 112 of file XrdSsiFileReq.hh.

{if (tident) free(tident);}

## Member Function Documentation

## Activate()

void XrdSsiFileReq::Activate | ( | XrdOucBuffer * | oP,
|  | XrdSfsXioHandle | bR,
|  | int | rSz )

Definition at line 130 of file XrdSsiFileReq.cc.

{
EPNAME("Activate");
// Do some debugging
//
DEBUGXQ((oP ? "oucbuff" : "sfsbuff") <<" rqsz=" <<rSz);
// Do statistics
//
Stats.statsMutex.Lock();
Stats.ReqCount++;
Stats.ReqBytes += rSz;
if (rSz > Stats.ReqMaxsz) Stats.ReqMaxsz = rSz;
Stats.statsMutex.UnLock();
// Set request buffer pointers
//
oucBuff = oP;
sfsBref = bR;
reqSize = rSz;
// Now schedule ourselves to process this request. The state is new.
//
Sched->Schedule((XrdJob *)this);
}
EPNAME
#define EPNAME(x)
Definition XrdBwmTrace.hh:56
DEBUGXQ
#define DEBUGXQ(x)
Definition XrdSsiFileReq.cc:56
XrdJob::XrdJob
XrdJob(const char *desc="")
Definition XrdJob.hh:51
XrdOucStats::statsMutex
XrdSysMutex statsMutex
Definition XrdOucStats.hh:55
XrdScheduler::Schedule
void Schedule(XrdJob *jp)
Definition XrdScheduler.cc:373
XrdSsiStats::ReqMaxsz
long long ReqMaxsz
Definition XrdSsiStats.hh:41
XrdSsiStats::ReqCount
int ReqCount
Definition XrdSsiStats.hh:47
XrdSsiStats::ReqBytes
long long ReqBytes
Definition XrdSsiStats.hh:40
XrdSysMutex::Lock
void Lock()
Definition XrdSysPthread.hh:222
XrdSysMutex::UnLock
void UnLock()
Definition XrdSysPthread.hh:224
XrdSsi::Stats
XrdSsiStats Stats
Definition XrdSsiFileReq.cc:69
XrdSsi::Sched
XrdScheduler * Sched
Definition XrdSsiSfsConfig.cc:87

References XrdJob::XrdJob(), DEBUGXQ, EPNAME, XrdSsi::Sched, and XrdSsi::Stats.

Here is the call graph for this function:

## Alert()

void XrdSsiFileReq::Alert | ( | XrdSsiRespInfoMsg & | aMsg | ) |

virtual

Send or receive a server generated alert.

The Alert() method is used server-side to send one or more alerts before a response is posted (alerts afterwards are ignored). To avoid race conditions, server-side alerts should be sent via the Responder's Alert() method. Clients must implement this method in order to receive alerts.

Parameters

  aMsg | Reference to the message object containing the alert message. Non-positive alert lengths cause the alert call to be ignored. You should call the message RecycleMsg() method once you have consumed the message to release its resources.

Reimplemented from XrdSsiRequest.

Definition at line 161 of file XrdSsiFileReq.cc.

{
EPNAME("Alert");
XrdSsiAlert *aP;
int msgLen;
// Do some debugging
//
aMsg.GetMsg(msgLen);
DEBUGXQ(msgLen <<" byte alert presented wtr=" <<respWait);
// Add up statistics
//
Stats.Bump(Stats.ReqAlerts);
// Lock this object
//
frqMutex.Lock();
// Validate the length and whether this call is allowed
//
if (msgLen <= 0 || haveResp || isEnding)
{frqMutex.UnLock();
aMsg.RecycleMsg();
return;
}
// Allocate an alert object and chain it into the pending queue
//
aP = XrdSsiAlert::Alloc(aMsg);
// Alerts must be sent in the orer they are presented. So, check if we need
// to chain this and try to send the first in the chain. This only really
// matters if we can send the alert now because the client is waiting.
//
if (respWait)
{if (alrtPend)
{alrtLast->next = aP;
alrtLast = aP;
aP = alrtPend;
alrtPend = alrtPend->next;
}
WakeUp(aP);
} else {
if (alrtLast) alrtLast->next = aP;
else alrtPend = aP;
alrtLast = aP;
}
// All done
//
frqMutex.UnLock();
}
XrdOucStats::Bump
void Bump(int &val)
Definition XrdOucStats.hh:47
XrdSsiAlert::Alloc
static XrdSsiAlert * Alloc(XrdSsiRespInfoMsg &aMsg)
Definition XrdSsiAlert.cc:52
XrdSsiAlert::next
XrdSsiAlert * next
Definition XrdSsiAlert.hh:41
XrdSsiRespInfoMsg::GetMsg
char * GetMsg(int &mlen)
Definition XrdSsiRespInfo.hh:99
XrdSsiRespInfoMsg::RecycleMsg
virtual void RecycleMsg(bool sent=true)=0
XrdSsiStats::ReqAlerts
int ReqAlerts
Definition XrdSsiStats.hh:44

References XrdSsiAlert::Alloc(), DEBUGXQ, EPNAME, XrdSsiRespInfoMsg::GetMsg(), XrdSsiAlert::next, XrdSsiRespInfoMsg::RecycleMsg(), and XrdSsi::Stats.

Here is the call graph for this function:

## Alloc()

XrdSsiFileReq * XrdSsiFileReq::Alloc | ( | XrdOucErrInfo * | eP,
|  | XrdSsiFileResource * | rP,
|  | XrdSsiFileSess * | fP,
|  | const char * | sn,
|  | const char * | id,
|  | unsigned int | rnum )

static

Definition at line 219 of file XrdSsiFileReq.cc.

{
XrdSsiFileReq *nP;
// Check if we can grab this from out queue
//
aqMutex.Lock();
if ((nP = freeReq))
{freeCnt--;
freeReq = nP->nextReq;
aqMutex.UnLock();
nP->Init(cID);
} else {
aqMutex.UnLock();
nP = new XrdSsiFileReq(cID);
}
// Initialize for processing
//
if (nP)
{nP->sessN = sID;
nP->fileR = rP;
nP->fileP = fP;
nP->cbInfo = eiP;
nP->reqID = rnum;
snprintf(nP->rID, sizeof(nP->rID), "%u:", rnum);
}
// Return the pointer
//
return nP;
}
XrdSsiFileReq::XrdSsiFileReq
XrdSsiFileReq(const char *cID=0)
Definition XrdSsiFileReq.hh:108

References XrdSsiFileReq().

Here is the call graph for this function:

## DeferredFinalize()

void XrdSsiFileReq::DeferredFinalize | ( |  | ) |

Definition at line 302 of file XrdSsiFileReq.cc.

{
Sched->Schedule(new FinalizeJob(this, fileP, reqID));
}

References XrdSsi::Sched.

## DoIt()

void XrdSsiFileReq::DoIt | ( |  | ) |

virtual

Implements XrdJob.

Definition at line 332 of file XrdSsiFileReq.cc.

{
EPNAME("DoIt");
bool cancel;
// Processing is determined by the responder's state. Only listed states are
// valid. Others should never occur in this context.
//
frqMutex.Lock();
switch(urState)
{case isNew: myState = xqReq; urState = isBegun;
DEBUGXQ("Calling service processor");
frqMutex.UnLock();
Stats.Bump(Stats.ReqProcs);
Service->ProcessRequest((XrdSsiRequest &)*this,
(XrdSsiFileResource &)*fileR);
return;
break;
case isAbort: DEBUGXQ("Skipped calling service processor");
frqMutex.UnLock();
Stats.Bump(Stats.ReqAborts);
Recycle();
return;
break;
case isDone: cancel = (myState != odRsp);
DEBUGXQ("Calling Finished(" <<cancel <<')');
if (respWait) WakeUp();
if (finWait) finWait->Post();
frqMutex.UnLock();
Stats.Bump(Stats.ReqFinished);
if (cancel) Stats.Bump(Stats.ReqCancels);
Finished(cancel); // This object may be deleted!
return;
break;
default: break;
}
// If we get here then we have an invalid state. Report it but otherwise we
// can't really do anything else. This means some memory may be lost.
//
frqMutex.UnLock();
Log.Emsg(epname, tident, "Invalid req/rsp state; giving up on object!");
}
XrdSsiFileReq::Finished
void Finished(XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false)
Definition XrdSsiFileReq.hh:74
XrdSsiRequest::XrdSsiRequest
XrdSsiRequest(const char *reqid=0, uint16_t tmo=0)
Definition XrdSsiRequest.cc:56
XrdSsiService::ProcessRequest
virtual void ProcessRequest(XrdSsiRequest &reqRef, XrdSsiResource &resRef)=0
Process a request; client-side or server-side.
XrdSsiStats::ReqCancels
int ReqCancels
Definition XrdSsiStats.hh:46
XrdSsiStats::ReqAborts
int ReqAborts
Definition XrdSsiStats.hh:43
XrdSsiStats::ReqFinished
int ReqFinished
Definition XrdSsiStats.hh:49
XrdSsiStats::ReqProcs
int ReqProcs
Definition XrdSsiStats.hh:52
XrdSysError::Emsg
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
Definition XrdSysError.cc:95
XrdSsi::Service
XrdSsiService * Service
Definition XrdSsiFileSess.cc:72
XrdSsi::Log
XrdSysError Log
Definition XrdSsiFileReq.cc:66

References XrdSsiRequest::XrdSsiRequest(), DEBUGXQ, EPNAME, Finished(), isAbort, isBegun, isDone, isNew, XrdSsi::Log, odRsp, XrdSsi::Service, XrdSsi::Stats, and xqReq.

Here is the call graph for this function:

## Done()

void XrdSsiFileReq::Done | ( | int & | Result,
|  | XrdOucErrInfo * | eInfo,
|  | const char * | Path = 0 )

virtual

Invoke a callback after an operation completes.

Parameters

  Result | - the original function's result (may be changed).

  eInfo

  - Associated error information. The eInfo object may not be modified until it's own callback Done() method is called, if supplied. If the callback function in eInfo is zero, then the eInfo object is deleted by the invoked callback. Otherwise, that method must be invoked by this callback function after the actual callback message is sent. This allows the callback requestor to do post-processing and be asynchronous being assured that the callback completed.

  Path | - Optionally, the path related to thid request. It is used for tracing and detailed monitoring purposes.

Implements XrdOucEICB.

Definition at line 382 of file XrdSsiFileReq.cc.

{
EPNAME("Done");
XrdSsiMutexMon mHelper(frqMutex);
// We may need to delete the errinfo object if this callback was async. Note
// that the following test is valid even if the file object has been deleted.
//
if (eiP != fileP->errInfo()) delete eiP;
// Check if we should finalize this request. This will be the case if the
// complete response was sent.
//
if (myState == odRsp)
{DEBUGXQ("resp sent; no additional data remains");
if (!fileP->DeferFinalize(this,reqID)) Finalize();
return;
}
// Do some debugging
//
DEBUGXQ("wtrsp sent; resp " <<(haveResp ? "here" : "pend"));
// We are invoked when sync() waitresp has been sent, check if a response was
// posted while this was going on. If so, make sure to send a wakeup. Note
// that the respWait flag is at this moment false as this is called in the
// sync response path for fctl() and the response may have been posted.
//
if (!haveResp) respWait = true;
else WakeUp();
}
XrdSsiFileReq::Finalize
void Finalize()
Definition XrdSsiFileReq.cc:484

References DEBUGXQ, EPNAME, Finalize(), and odRsp.

Here is the call graph for this function:

## Finalize()

void XrdSsiFileReq::Finalize | ( |  | ) |

Definition at line 484 of file XrdSsiFileReq.cc.

{
EPNAME("Finalize");
XrdSsiMutexMon mHelper(frqMutex);
bool cancel = (myState != odRsp);
// Release any unsent alerts (prevent any new alerts from being accepted)
//
isEnding = true;
if (alrtSent || alrtPend)
{XrdSsiAlert *dP, *aP = alrtSent;
if (aP) aP->next = alrtPend;
else aP = alrtPend;
mHelper.UnLock();
while((dP = aP)) {aP = aP->next; dP->Recycle();}
mHelper.Lock(frqMutex);
}
// Processing is determined by the responder's state
//
switch(urState)
// Request is being scheduled, so we can simply abort it.
//
{case isNew: urState = isAbort;
cbInfo = 0;
sessN = "???";
Stats.Bump(Stats.ReqAborts);
DEBUGXQ("Aborting request processing");
return;
break;
// Request already handed off but not yet bound. Defer until bound.
// We need to wait until this occurs to sequence Unprovision().
//
case isBegun: urState = isDone;
{XrdSysSemaphore wt4fin(0);
finWait = &wt4fin;
mHelper.UnLock();
wt4fin.Wait();
}
sessN = "n/a";
return;
// Request is bound so we can finish right off.
//
case isBound: urState = isDone;
if (strBuff) {strBuff->Recycle(); strBuff = 0;}
DEBUGXQ("Calling Finished(" <<cancel <<')');
if (respWait) WakeUp();
mHelper.UnLock();
Stats.Bump(Stats.ReqFinished);
if (cancel) Stats.Bump(Stats.ReqCancels);
Finished(cancel); // This object may be deleted!
sessN = "n/a";
return;
break;
// The following two cases may happen but it's safe to ignore them.
//
case isAbort:
case isDone: sessN = "bad";
return;
break;
default: break;
}
// If we get here then we have an invalid state. Report it but otherwise we
// can't really do anything else. This means some memory may be lost.
//
Log.Emsg(epname, tident, "Invalid req/rsp state; giving up on object!");
}
XrdSsiAlert::Recycle
void Recycle()
Definition XrdSsiAlert.cc:98

References DEBUGXQ, EPNAME, Finished(), isAbort, isBegun, isBound, isDone, isNew, XrdSsiMutexMon::Lock(), XrdSsi::Log, XrdSsiAlert::next, odRsp, XrdSsiAlert::Recycle(), XrdSsi::Stats, XrdSsiMutexMon::UnLock(), and XrdSysSemaphore::Wait().

Referenced by Done().

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

## Finished() [1/2]

bool XrdSsiRequest::Finished | ( | bool | cancel = false | ) |

Indicate that request processing has been finished. This method calls XrdSsiResponder::Finished() on the associated responder object.

Note: This method locks the object's recursive mutex.

Parameters

  cancel | False -> the request/response sequence completed normally. True -> the request/response sequence aborted because of an error or the client cancelled the request.

Returns
  true Finish accepted. Request object may be reclaimed.
  false Finish cannot be accepted because this request object is not bound to a responder. This indicates a logic error.

Definition at line 91 of file XrdSsiRequest.cc.

{
XrdSsiResponder *respP;
// Obtain the responder
//
rrMutex->Lock();
respP = theRespond;
theRespond = 0;
rrMutex->UnLock();
// Tell any responder we are finished (we might not have one)
//
if (respP) respP->Finished(*this, Resp, cancel);
// We are done. The object will be reiniialized when UnBindRequest() is
// called which will call UnBind() in this object. Since the timing is not
// known we can't touch anthing in this object at this point.
// Return false if there was no responder associated with this request.
//
return respP != 0;
}
XrdSsiRequest::XrdSsiResponder
friend class XrdSsiResponder
Definition XrdSsiRequest.hh:73
XrdSsiResponder::Finished
virtual void Finished(XrdSsiRequest &rqstR, const XrdSsiRespInfo &rInfo, bool cancel=false)=0

## Finished() [2/2]

void XrdSsiFileReq::Finished | ( | XrdSsiRequest & | rqstR,
|  | const XrdSsiRespInfo & | rInfo,
|  | bool | cancel = false )

inline

Definition at line 74 of file XrdSsiFileReq.hh.

{}

References XrdSsiRequest::XrdSsiRequest().

Referenced by DoIt(), and Finalize().

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

## GetRequest()

char * XrdSsiFileReq::GetRequest | ( | int & | dlen | ) |

virtual

Obtain the request data sent by a client.

This method is duplicated in XrdSsiResponder to allow calling consistency.

Parameters

  dlen | holds the length of the request after the call.

Returns
  =0 No request data available, dlen has been set to zero.
  !0 Pointer to the buffer holding the request, dlen has the length

Implements XrdSsiRequest.

Definition at line 560 of file XrdSsiFileReq.cc.

{
EPNAME("GetRequest");
// Do some debugging
//
DEBUGXQ("sz=" <<reqSize);
Stats.Bump(Stats.ReqGets);
// The request may come from a ouc buffer or an sfs buffer
//
rLen = reqSize;
if (oucBuff) return oucBuff->Data();
return XrdSfsXio::Buffer(sfsBref);
}
XrdSfsXio::Buffer
static char * Buffer(XrdSfsXioHandle theHand, int *buffsz=0)
Definition XrdSfsXio.cc:61
XrdSsiStats::ReqGets
int ReqGets
Definition XrdSsiStats.hh:50

References XrdSfsXio::Buffer(), DEBUGXQ, EPNAME, and XrdSsi::Stats.

Here is the call graph for this function:

## ProcessResponse()

bool XrdSsiFileReq::ProcessResponse | ( | const XrdSsiErrInfo & | eInfo,
|  | const XrdSsiRespInfo & | rInfo )

virtual

Notify request that a response is ready to be processed. This method must be supplied by the request object's implementation.

Parameters

  eInfo | Error information. You can check if an error occurred using eInfo.hasError() or eInfo.isOK().
  rInfo | Raw response information.

Returns
  true Response processed.
  false Response could not be processed, the request is not active.

Implements XrdSsiRequest.

Definition at line 617 of file XrdSsiFileReq.cc.

{
EPNAME("ProcessResponse");
// Do some debugging
//
DEBUGXQ("Response presented wtr=" <<respWait);
// Make sure we are still in execute state
//
if (urState != isBegun && urState != isBound) return false;
myState = doRsp;
respOff = 0;
// Handle the response
//
switch(Resp.rType)
{case XrdSsiRespInfo::isData:
DEBUGXQ("Resp data sz="<<Resp.blen);
respLen = Resp.blen;
Stats.Bump(Stats.RspData);
break;
case XrdSsiRespInfo::isError:
DEBUGXQ("Resp err rc="<<Resp.eNum<<" msg="<<Resp.eMsg);
respLen = 0;
Stats.Bump(Stats.RspErrs);
break;
case XrdSsiRespInfo::isFile:
DEBUGXQ("Resp file fd="<<Resp.fdnum<<" sz="<<Resp.fsize);
fileSz = Resp.fsize;
respOff = 0;
Stats.Bump(Stats.RspFile);
break;
case XrdSsiRespInfo::isStream:
DEBUGXQ("Resp strm");
respLen = 0;
Stats.Bump(Stats.RspStrm);
break;
default:
DEBUGXQ("Resp invalid!!!!");
return false;
Stats.Bump(Stats.RspBad);
break;
}
// If the client is waiting for the response, wake up the client to get it.
//
haveResp = true;
if (respWait) WakeUp();
return true;
}
XrdSsiStats::RspStrm
int RspStrm
Definition XrdSsiStats.hh:62
XrdSsiStats::RspFile
int RspFile
Definition XrdSsiStats.hh:60
XrdSsiStats::RspErrs
int RspErrs
Definition XrdSsiStats.hh:59
XrdSsiStats::RspBad
int RspBad
Definition XrdSsiStats.hh:56
XrdSsiStats::RspData
int RspData
Definition XrdSsiStats.hh:58
XrdSsiRespInfo::isFile
@ isFile
Definition XrdSsiRespInfo.hh:58
XrdSsiRespInfo::isError
@ isError
Definition XrdSsiRespInfo.hh:58
XrdSsiRespInfo::isStream
@ isStream
Definition XrdSsiRespInfo.hh:58
XrdSsiRespInfo::isData
@ isData
Definition XrdSsiRespInfo.hh:58

References DEBUGXQ, doRsp, EPNAME, isBegun, isBound, XrdSsiRespInfo::isData, XrdSsiRespInfo::isError, XrdSsiRespInfo::isFile, XrdSsiRespInfo::isStream, and XrdSsi::Stats.

## Read()

XrdSfsXferSize XrdSsiFileReq::Read | ( | bool & | done,
|  | char * | buffer,
|  | XrdSfsXferSize | blen )

Definition at line 674 of file XrdSsiFileReq.cc.

{
static const char *epname = "read";
XrdSfsXferSize nbytes;
XrdSsiRespInfo const *Resp = XrdSsiRRAgent::RespP(this);
// A read should never be issued unless a response has been set
//
if (myState != doRsp)
{done = true;
return (myState == odRsp ? 0 : Emsg(epname, ENOMSG, "read"));
}
// Fan out based on the kind of response we have
//
switch(Resp->rType)
{case XrdSsiRespInfo::isData:
if (respLen <= 0) {done = true; myState = odRsp; return 0;}
if (blen >= respLen)
{memcpy(buff, Resp->buff+respOff, respLen);
blen = respLen; myState = odRsp; done = true;
} else {
memcpy(buff, Resp->buff+respOff, blen);
respLen -= blen; respOff += blen;
}
return blen;
break;
case XrdSsiRespInfo::isError:
cbInfo->setErrInfo(Resp->eNum, Resp->eMsg);
myState = odRsp; done = true;
return SFS_ERROR;
break;
case XrdSsiRespInfo::isFile:
if (fileSz <= 0) {done = true; myState = odRsp; return 0;}
nbytes = pread(Resp->fdnum, buff, blen, respOff);
if (nbytes <= 0)
{done = true;
if (!nbytes) {myState = odRsp; return 0;}
myState = erRsp;
return Emsg(epname, errno, "read");
}
respOff += nbytes; fileSz -= nbytes;
return nbytes;
break;
case XrdSsiRespInfo::isStream:
nbytes = (Resp->strmP->Type() == XrdSsiStream::isActive ?
readStrmA(Resp->strmP, buff, blen)
: readStrmP(Resp->strmP, buff, blen));
done = strmEOF && strBuff == 0;
return nbytes;
break;
default: break;
};
// We should never get here
//
myState = erRsp;
done = true;
return Emsg(epname, EFAULT, "read");
}
pread
#define pread(a, b, c, d)
Definition XrdPosix.hh:80
SFS_ERROR
#define SFS_ERROR
Definition XrdSfsInterface.hh:109
XrdSfsXferSize
int XrdSfsXferSize
Definition XrdSfsInterface.hh:131
XrdSsiRRAgent::RespP
static XrdSsiRespInfo * RespP(XrdSsiRequest *rP)
Definition XrdSsiRRAgent.hh:63
XrdSsiStream::isActive
@ isActive
Definition XrdSsiStream.hh:144

References doRsp, erRsp, XrdSsiStream::isActive, XrdSsiRespInfo::isData, XrdSsiRespInfo::isError, XrdSsiRespInfo::isFile, XrdSsiRespInfo::isStream, odRsp, pread, XrdSsiRRAgent::RespP(), and SFS_ERROR.

Here is the call graph for this function:

## RelRequestBuffer()

void XrdSsiFileReq::RelRequestBuffer | ( |  | ) |

virtual

Release the request buffer. Use this method to optimize storage use; this is especially relevant for long-running requests. If the request buffer has been consumed and is no longer needed, early return of the buffer will minimize memory usage. This method is also invoked via XrdSsiResponder.

Note: This method is called with the object's recursive mutex locked when it is invoked via XrdSsiResponder's ReleaseRequestBuffer().

Reimplemented from XrdSsiRequest.

Definition at line 853 of file XrdSsiFileReq.cc.

{
EPNAME("RelReqBuff");
XrdSsiMutexMon mHelper(frqMutex);
// Do some debugging
//
DEBUGXQ("called");
Stats.Bump(Stats.ReqRelBuf);
// Release buffers
//
if (oucBuff) {oucBuff->Recycle(); oucBuff = 0;}
else if (sfsBref) {XrdSfsXio::Reclaim(sfsBref); sfsBref = 0;}
reqSize = 0;
}
XrdSfsXio::Reclaim
static void Reclaim(XrdSfsXioHandle theHand)
Definition XrdSfsXio.cc:70
XrdSsiStats::ReqRelBuf
int ReqRelBuf
Definition XrdSsiStats.hh:54

References DEBUGXQ, EPNAME, XrdSfsXio::Reclaim(), and XrdSsi::Stats.

Here is the call graph for this function:

## Same()

int XrdSsiFileReq::Same | ( | unsigned long long | arg1,
|  | unsigned long long | arg2 )

inline virtual

Determine if two callback arguments refer to the same client.

Parameters

  arg1 | - The first callback argument.
  arg2 | - The second callback argument.

Returns
  !0 - The arguments refer to the same client.
  =0 - The arguments refer to the different clients.

Implements XrdOucEICB.

Definition at line 100 of file XrdSsiFileReq.hh.

{return 0;}

## Send()

int XrdSsiFileReq::Send | ( | XrdSfsDio * | sfDio,
|  | XrdSfsXferSize | size )

Definition at line 874 of file XrdSsiFileReq.cc.

{
static const char *epname = "send";
XrdSsiRespInfo const *Resp = XrdSsiRRAgent::RespP(this);
XrdOucSFVec sfVec[2];
int rc;
// A send should never be issued unless a response has been set. Return a
// continuation which will cause Read() to be called to return the error.
//
if (myState != doRsp) return 1;
// Fan out based on the kind of response we have
//
switch(Resp->rType)
{case XrdSsiRespInfo::isData:
if (blen > 0)
{sfVec[1].buffer = (char *)Resp->buff+respOff;
sfVec[1].fdnum = -1;
if (blen > respLen)
{blen = respLen; myState = odRsp;
} else {
respLen -= blen; respOff += blen;
}
} else blen = 0;
break;
case XrdSsiRespInfo::isError:
return 1; // Causes error to be returned via Read()
break;
case XrdSsiRespInfo::isFile:
if (fileSz > 0)
{sfVec[1].offset = respOff; sfVec[1].fdnum = Resp->fdnum;
if (blen > fileSz)
{blen = fileSz; myState = odRsp;}
respOff += blen; fileSz -= blen;
} else blen = 0;
break;
case XrdSsiRespInfo::isStream:
if (Resp->strmP->Type() == XrdSsiStream::isPassive) return 1;
return sendStrmA(Resp->strmP, sfDio, blen);
break;
default: myState = erRsp;
return Emsg(epname, EFAULT, "send");
break;
};
// Send off the data
//
if (!blen) {sfVec[1].buffer = rID; myState = odRsp;}
sfVec[1].sendsz = blen;
rc = sfDio->SendFile(sfVec, 2);
// If send succeeded, indicate the action to be taken
//
if (!rc) return myState != odRsp;
// The send failed, diagnose the problem
//
rc = (rc < 0 ? EIO : EFAULT);
myState = erRsp;
return Emsg(epname, rc, "send");
}
XrdSfsDio::SendFile
virtual int SendFile(int fildes)=0
XrdSsiStream::isPassive
@ isPassive
Definition XrdSsiStream.hh:144
XrdOucSFVec::fdnum
int fdnum
File descriptor for data.
Definition XrdOucSFVec.hh:47
XrdOucSFVec::sendsz
int sendsz
Length of data at offset.
Definition XrdOucSFVec.hh:46

References doRsp, erRsp, XrdOucSFVec::fdnum, XrdSsiRespInfo::isData, XrdSsiRespInfo::isError, XrdSsiRespInfo::isFile, XrdSsiStream::isPassive, XrdSsiRespInfo::isStream, odRsp, XrdSsiRRAgent::RespP(), XrdSfsDio::SendFile(), and XrdOucSFVec::sendsz.

Here is the call graph for this function:

## SetMax()

void XrdSsiFileReq::SetMax | ( | int | mVal | ) |

inline static

Definition at line 91 of file XrdSsiFileReq.hh.

{freeMax = mVal;}

## WantResponse()

bool XrdSsiFileReq::WantResponse | ( | XrdOucErrInfo & | eInfo | ) |

Definition at line 996 of file XrdSsiFileReq.cc.

{
EPNAME("WantResp");
XrdSsiMutexMon frqMon;
const XrdSsiRespInfo *rspP;
// Check if we have a previos alert that was sent (we need to recycle it). We
// don't need a lock for this as it's fully serialized via serial fsctl calls.
//
if (alrtSent) {alrtSent->Recycle(); alrtSent = 0;}
// Serialize the remainder of this code
//
frqMon.Lock(frqMutex);
rspP = XrdSsiRRAgent::RespP(this);
// If we have a pending alert then we need to send it now. Suppress the callback
// as we will recycle the alert on the next call (there should be one).
//
if (alrtPend)
{char hexBuff[16], binBuff[8], dotBuff[4];
alrtSent = alrtPend;
if (!(alrtPend = alrtPend->next)) alrtLast = 0;
int n = alrtSent->SetInfo(eInfo, binBuff, sizeof(binBuff));
eInfo.setErrCB((XrdOucEICB *)0);
DEBUGXQ(n <<" byte alert (0x" <<DUMPIT(binBuff, n) <<") sent; "
<<(alrtPend ? "" : "no ") <<"more pending");
return true;
}
// Check if a response is here (well, ProcessResponse was called)
//
// if (rspP->rType)
if (haveResp)
{respCBarg = 0;
if (fileP->AttnInfo(eInfo, rspP, reqID)) myState = odRsp;
else eInfo.setErrCB((XrdOucEICB *)0);
return true;
}
// Defer this and record the callback arguments. We defer setting respWait
// to true until we know the deferal request has been sent (i.e. when Done()
// is called). This forces ProcessResponse() to not prematurely wakeup the
// client. This is necessitated by the fact that we must release the request
// lock upon return; allowing a response to come in while the deferal request
// is still in transit.
//
respCB = eInfo.getErrCB(respCBarg);
respWait = false;
return false;
}
DUMPIT
#define DUMPIT(x, y)
Definition XrdSsiFileReq.cc:58
XrdOucEICB::XrdOucEICB
XrdOucEICB()
Constructor and destructor.
Definition XrdOucErrInfo.hh:522
XrdOucErrInfo::getErrCB
XrdOucEICB * getErrCB()
Definition XrdOucErrInfo.hh:224
XrdOucErrInfo::setErrCB
void setErrCB(XrdOucEICB *cb, unsigned long long cbarg=0)
Definition XrdOucErrInfo.hh:125
XrdSsiMutexMon::Lock
void Lock(XrdSsiMutex *mutex)
Definition XrdSsiAtomics.hh:152

References XrdOucEICB::XrdOucEICB(), DEBUGXQ, DUMPIT, EPNAME, XrdOucErrInfo::getErrCB(), XrdSsiMutexMon::Lock(), odRsp, XrdSsiRRAgent::RespP(), and XrdOucErrInfo::setErrCB().

Here is the call graph for this function:

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

- XrdSsiFileReq.hh
- XrdSsiFileReq.cc