XRootD
Loading...
Searching...
No Matches
XrdXrootdCBJob Class Reference
+ Inheritance diagram for XrdXrootdCBJob:
+ Collaboration diagram for XrdXrootdCBJob:

Public Member Functions

 XrdXrootdCBJob (XrdXrootdCallBack *cbp, XrdOucErrInfo *erp, const char *path, int rval)
 
 ~XrdXrootdCBJob ()
 
void DoIt ()
 
void Recycle ()
 

Static Public Member Functions

static XrdXrootdCBJobAlloc (XrdXrootdCallBack *cbF, XrdOucErrInfo *erp, const char *Path, int rval)
 

Detailed Description

Definition at line 54 of file XrdXrootdCallBack.cc.

Constructor & Destructor Documentation

◆ XrdXrootdCBJob()

XrdXrootdCBJob::XrdXrootdCBJob ( XrdXrootdCallBack cbp,
XrdOucErrInfo erp,
const char *  path,
int  rval 
)
inline

Definition at line 69 of file XrdXrootdCallBack.cc.

73 : XrdJob("async response"),
74 cbFunc(cbp), eInfo(erp), Path(path),
75 Result(rval) {}

References Path.

◆ ~XrdXrootdCBJob()

XrdXrootdCBJob::~XrdXrootdCBJob ( )
inline

Definition at line 77 of file XrdXrootdCallBack.cc.

77{}

Member Function Documentation

◆ Alloc()

XrdXrootdCBJob * XrdXrootdCBJob::Alloc ( XrdXrootdCallBack cbF,
XrdOucErrInfo erp,
const char *  Path,
int  rval 
)
static

Definition at line 116 of file XrdXrootdCallBack.cc.

120{
121 XrdXrootdCBJob *cbj;
122
123// Obtain a call back object by trying to avoid new()
124//
125 myMutex.Lock();
126 if (!(cbj = FreeJob)) cbj = new XrdXrootdCBJob(cbF, erp, Path, rval);
127 else {cbj->cbFunc = cbF, cbj->eInfo = erp;
128 cbj->Result = rval;cbj->Path = Path;
129 FreeJob = cbj->Next;
130 }
131 myMutex.UnLock();
132
133// Return the new object
134//
135 return cbj;
136}

References XrdSysMutex::Lock(), Path, and XrdSysMutex::UnLock().

Referenced by XrdXrootdCallBack::Done().

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

◆ DoIt()

void XrdXrootdCBJob::DoIt ( )
virtual

Implements XrdJob.

Definition at line 142 of file XrdXrootdCallBack.cc.

143{
144 static const char *TraceID = "DoIt";
145 XrdXrootdFile *fP = 0;
146
147// Do some tracing here
148//
149 TRACE(RSP, eInfo->getErrUser() <<' ' <<cbFunc->Func() <<" async callback");
150
151// Some operations differ in the way we handle them. For instance, for open()
152// if it succeeds then we must force the client to retry the open request
153// because we can't attach the file to the client here. We do this by asking
154// the client to wait zero seconds. Protocol demands a client retry. Close
155// operations are always final and we need to do some cleanup.
156//
157 if (*(cbFunc->Func()) == 'c') fP = DoClose(eInfo);
158 else if (SFS_OK == Result)
159 {if (*(cbFunc->Func()) == 'o')
160 {int rc = 0; cbFunc->sendResp(eInfo, kXR_wait, &rc);}
161 else {if (*(cbFunc->Func()) == 'x') DoStatx(eInfo);
162 cbFunc->sendResp(eInfo, kXR_ok, 0, eInfo->getErrText(),
163 eInfo->getErrTextLen());
164 }
165 }
166 else cbFunc->sendError(Result, eInfo, Path);
167
168// Tell the requestor that the callback has completed
169//
170 if (eInfo->getErrCB()) eInfo->getErrCB()->Done(Result, eInfo);
171 else delete eInfo;
172 eInfo = 0;
173 if (fP) delete fP;
174 Recycle();
175}
@ kXR_ok
Definition XProtocol.hh:899
@ kXR_wait
Definition XProtocol.hh:905
#define SFS_OK
#define TRACE(act, x)
Definition XrdTrace.hh:63
virtual void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)=0
const char * getErrUser()
XrdOucEICB * getErrCB()
const char * getErrText()
void sendError(int rc, XrdOucErrInfo *eInfo, const char *Path)
void sendResp(XrdOucErrInfo *eInfo, XResponseType xrt, int *Data=0, const char *Msg=0, int Mlen=0)

References XrdOucEICB::Done(), XrdXrootdCallBack::Func(), XrdOucErrInfo::getErrCB(), XrdOucErrInfo::getErrText(), XrdOucErrInfo::getErrTextLen(), XrdOucErrInfo::getErrUser(), kXR_ok, kXR_wait, Recycle(), XrdXrootdCallBack::sendError(), XrdXrootdCallBack::sendResp(), SFS_OK, and TRACE.

+ Here is the call graph for this function:

◆ Recycle()

void XrdXrootdCBJob::Recycle ( )
inline

Definition at line 63 of file XrdXrootdCallBack.cc.

63 {myMutex.Lock();
64 Next = FreeJob;
65 FreeJob = this;
66 myMutex.UnLock();
67 }

References XrdSysMutex::Lock(), and XrdSysMutex::UnLock().

Referenced by DoIt().

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

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