diff --git a/src/XrdSsi/XrdSsiSessReal.cc b/src/XrdSsi/XrdSsiSessReal.cc index a9a47ca0a95..e602c3e38a7 100644 --- a/src/XrdSsi/XrdSsiSessReal.cc +++ b/src/XrdSsi/XrdSsiSessReal.cc @@ -170,13 +170,20 @@ XrdSsiTaskReal *XrdSsiSessReal::NewTask(XrdSsiRequest *reqP) // Allocate a task object for this request // if ((tP = freeTask)) freeTask = tP->attList.next; - else {if (!alocLeft || !(tP = new XrdSsiTaskReal(this, nextTID))) + else {if (!alocLeft || !(tP = new XrdSsiTaskReal(this))) {XrdSsiUtils::RetErr(*reqP, "Too many active requests.", EMLINK); return 0; } - alocLeft--; nextTID++; + alocLeft--; } +// We always set a new task ID to avoid ID collisions. his is good for over +// 194 days if we have 1 request/second. In practice. this will work for a +// couple of years before wrapping. By then the ID's should be free. +// + tP->SetTaskID(nextTID++); + nextTID &= XrdSsiRRInfo::idMax; + // Initialize the task and return its pointer // tP->Init(reqP, reqP->GetTimeOut()); diff --git a/src/XrdSsi/XrdSsiTaskReal.hh b/src/XrdSsi/XrdSsiTaskReal.hh index 97ad26c4641..89040bd79f0 100644 --- a/src/XrdSsi/XrdSsiTaskReal.hh +++ b/src/XrdSsi/XrdSsiTaskReal.hh @@ -83,14 +83,14 @@ int SetBuff(XrdSsiErrInfo &eRef, char *buff, int blen, bool &last); bool SetBuff(XrdSsiErrInfo &eRef, char *buff, int blen); -void SetTaskID(short tid) {tskID = tid;} +void SetTaskID(uint32_t tid) {tskID = tid;} bool XeqEvent(XrdCl::XRootDStatus *status, XrdCl::AnyObject **respP); - XrdSsiTaskReal(XrdSsiSessReal *sP, short tid) + XrdSsiTaskReal(XrdSsiSessReal *sP) : XrdSsiEvent("TaskReal"), XrdSsiStream(XrdSsiStream::isPassive), - sessP(sP), mdResp(0), wPost(0), tskID(tid), + sessP(sP), mdResp(0), wPost(0), tskID(0), mhPend(false), defer(false) {} @@ -116,8 +116,8 @@ XrdSysSemaphore *wPost; char *dataBuff; int dataRlen; TaskStat tStat; +uint32_t tskID; unsigned short tmOut; -short tskID; bool mhPend; bool defer; };