diff --git a/src/Xrd/XrdLink.cc b/src/Xrd/XrdLink.cc index bd4683338e7..72464bbf4ef 100644 --- a/src/Xrd/XrdLink.cc +++ b/src/Xrd/XrdLink.cc @@ -1277,12 +1277,11 @@ int XrdLink::Terminate(const XrdLink *owner, int fdnum, unsigned int inst) XrdSysCondVar killDone(0); XrdLink *lp; char buff[1024], *cp; - int wTime, didKW = KillCnt & KillXwt; + int wTime, killTries; // Find the correspodning link // - KillCnt = KillCnt & KillMsk; - if (!(lp = fd2link(fdnum, inst))) return (didKW ? -EPIPE : -ESRCH); + if (!(lp = fd2link(fdnum, inst))) return -ESRCH; // If this is self termination, then indicate that to the caller // @@ -1314,18 +1313,22 @@ int XrdLink::Terminate(const XrdLink *owner, int fdnum, unsigned int inst) // Check if we have too many tries here // - if (lp->KillCnt > KillMax) + killTries = lp->KillCnt & KillMsk; + if (killTries > KillMax) {lp->opMutex.UnLock(); return -ETIME; } - wTime = lp->KillCnt++; + +// Wait time increases as we have more unsuccessful kills. Update numbers. +// + wTime = killTries++; + lp->KillCnt = killTries | KillXwt; // Make sure we can disable this link. Of not, then force the caller to wait // a tad more than the read timeout interval. // if (!(lp->isEnabled) || lp->InUse > 1 || lp->KillcvP) {wTime = wTime*2+waitKill; - KillCnt |= KillXwt; lp->opMutex.UnLock(); return (wTime > 60 ? 60: wTime); } @@ -1344,7 +1347,7 @@ int XrdLink::Terminate(const XrdLink *owner, int fdnum, unsigned int inst) // Now wait for the link to shutdown. This avoids lock problems. // - if (killDone.Wait(int(killWait))) {wTime += killWait; KillCnt |= KillXwt;} + if (killDone.Wait(int(killWait))) wTime += killWait; else wTime = -EPIPE; killDone.UnLock(); diff --git a/src/XrdXrootd/XrdXrootdXeq.cc b/src/XrdXrootd/XrdXrootdXeq.cc index c169a9b871e..066fd0c27e8 100644 --- a/src/XrdXrootd/XrdXrootdXeq.cc +++ b/src/XrdXrootd/XrdXrootdXeq.cc @@ -706,13 +706,12 @@ int XrdXrootdProtocol::do_Endsess() TRACEP(LOGIN, "endsess " < 0) return (rc = Response.Send(kXR_wait, rc, "session still active")) ? rc:1; if (rc == -EACCES)return Response.Send(kXR_NotAuthorized, "not session owner"); - if (rc == -ESRCH) return Response.Send(kXR_NotFound, "session not found"); if (rc == -ETIME) return Response.Send(kXR_Cancelled,"session not ended"); return Response.Send();