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;}
212 {
int i = minAlloc;
while(i--) {hP->Next = Free; Free = hP; hP++;}}
213 if ((hP = Free)) Free = hP->Next;
224#define tident hP->Parms.Tident
232 int RespSize, readyH, Result,
Err;
246 if ((
Err = (readyH = Policy->Dispatch(RespBuff, RespSize)) < 0))
251 if (!(hP = refHandle(readyH)))
252 {sprintf(RespBuff,
"%d", readyH);
253 BwmEroute.Emsg(
"Dispatch",
"Lost handle from", RespBuff);
254 if (!
Err) Policy->Done(readyH);
262 {
BwmEroute.Emsg(
"Dispatch",
"ref to unscheduled handle",
264 if (!
Err) Policy->Done(readyH);
266 hP->myEICB.Wait(); hP->rTime = time(0);
270 erP->setErrCode(strlen(RespBuff));
298 } hTab[256] = {{0,0}};
307 if (hTab[i].Last) {hTab[i].Last->Next = hP; hTab[i].Last = hP;}
308 else {hTab[i].First = hTab[i].Last = hP; hP->Next = 0;}
312 while(hP && hP->rHandle != refID) {pP = hP; hP = hP->Next;}
314 {
if (pP) pP->Next = hP->Next;
315 else hTab[i].First = hP->Next;
316 if (hTab[i].Last == hP) hTab[i].Last = pP;
341 {Policy->Done(rHandle);
343 BwmEroute.Emsg(
"Retire",
"Lost handle to", Parms.Tident, Parms.Lfn);
351 myInfo.
Tident = Parms.Tident;
352 myInfo.
Lfn = Parms.Lfn;
353 myInfo.
lclNode = Parms.LclNode;
354 myInfo.
rmtNode = Parms.RmtNode;
355 myInfo.
ATime = qTime;
356 myInfo.
BTime = rTime;
357 myInfo.
CTime = time(0);
362 Logger->Event(myInfo);
367 if (Parms.Lfn) {free(Parms.Lfn); Parms.Lfn = 0;}
368 if (Parms.LclNode) {free(Parms.LclNode); Parms.LclNode = 0;}
369 if (Parms.RmtNode) {free(Parms.RmtNode); Parms.RmtNode = 0;}
380 int rc, startThread = (Policy == 0);
387 0,
"Handle Dispatcher")))
388 {
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)