50unsigned int XrdBwmHandle::numQueued = 0;
79int Same(
unsigned long long arg1,
unsigned long long arg2) {
return 0;}
109#define tident Parms.Tident
131 if (!(rc = Policy->Schedule(rBuff, rSize, Parms)))
return SFS_ERROR;
139 ZTRACE(sched,
"Run " <<Parms.Lfn <<
' ' <<Parms.LclNode
153 refHandle(rHandle,
this);
154 ZTRACE(sched,
"inQ " <<Parms.Lfn <<
' ' <<Parms.LclNode
169 const char *LclNode,
const char *RmtNode,
177 {hP->Parms.
Tident = theUsr;
178 hP->Parms.
Lfn = strdup(thePath);
179 hP->Parms.
LclNode = strdup(LclNode);
180 hP->Parms.
RmtNode = strdup(RmtNode);
209 if (old_hP) {old_hP->Next = Free; Free = old_hP; hP = 0;}
211 {
int i = minAlloc;
while(i--) {hP->Next = Free; Free = hP; hP++;}}
212 if ((hP = Free)) Free = hP->Next;
223#define tident hP->Parms.Tident
231 int RespSize, readyH, Result,
Err;
245 if ((
Err = (readyH = Policy->Dispatch(RespBuff, RespSize)) < 0))
250 if (!(hP = refHandle(readyH)))
251 {sprintf(RespBuff,
"%d", readyH);
252 BwmEroute.Emsg(
"Dispatch",
"Lost handle from", RespBuff);
253 if (!
Err) Policy->Done(readyH);
261 {
BwmEroute.Emsg(
"Dispatch",
"ref to unscheduled handle",
263 if (!
Err) Policy->Done(readyH);
265 hP->myEICB.Wait(); hP->rTime = time(0);
269 erP->setErrCode(strlen(RespBuff));
297 } hTab[256] = {{0,0}};
306 if (hTab[i].Last) {hTab[i].Last->Next = hP; hTab[i].Last = hP;}
307 else {hTab[i].First = hTab[i].Last = hP; hP->Next = 0;}
311 while(hP && hP->rHandle != refID) {pP = hP; hP = hP->Next;}
313 {
if (pP) pP->Next = hP->Next;
314 else hTab[i].First = hP->Next;
315 if (hTab[i].Last == hP) hTab[i].Last = pP;
340 {Policy->Done(rHandle);
342 BwmEroute.Emsg(
"Retire",
"Lost handle to", Parms.Tident, Parms.Lfn);
350 myInfo.
Tident = Parms.Tident;
351 myInfo.
Lfn = Parms.Lfn;
352 myInfo.
lclNode = Parms.LclNode;
353 myInfo.
rmtNode = Parms.RmtNode;
354 myInfo.
ATime = qTime;
355 myInfo.
BTime = rTime;
356 myInfo.
CTime = time(0);
361 Logger->Event(myInfo);
366 if (Parms.Lfn) {free(Parms.Lfn); Parms.Lfn = 0;}
367 if (Parms.LclNode) {free(Parms.LclNode); Parms.LclNode = 0;}
368 if (Parms.RmtNode) {free(Parms.RmtNode); Parms.RmtNode = 0;}
379 int rc, startThread = (Policy == 0);
386 0,
"Handle Dispatcher")))
387 {
BwmEroute.Emsg(
"setPolicy", rc,
"create handle dispatch thread");
void * XrdBwmHanXeq(void *pp)
static XrdBwmHandleCB * Alloc()
void Done(int &Results, XrdOucErrInfo *eInfo, const char *Path=0)
int Same(unsigned long long arg1, unsigned long long arg2)
int Activate(XrdOucErrInfo &einfo)
static XrdBwmHandle * Alloc(const char *theUsr, const char *thePath, const char *lclNode, const char *rmtNode, int Incoming)
static int setPolicy(XrdBwmPolicy *pP, XrdBwmLogger *lP)
virtual void Done(int &Result, XrdOucErrInfo *eInfo, const char *Path=0)=0
XrdOucEICB()
Constructor and destructor.
char * getMsgBuff(int &mblen)
void setErrCB(XrdOucEICB *cb, unsigned long long cbarg=0)
int setErrInfo(int code, const char *emsg)
XrdOucErrInfo(const char *user=0, XrdOucEICB *cb=0, unsigned long long ca=0, int mid=0, int uc=0)
static int Run(pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)