Skip to content

Commit

Permalink
[SSI] Expose refresh flag for better request retry control.
Browse files Browse the repository at this point in the history
  • Loading branch information
abh3 authored and simonmichal committed Oct 16, 2019
1 parent ba1f5ab commit 68d807c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/XrdSsi/XrdSsiRRAgent.hh
Expand Up @@ -47,6 +47,14 @@ static void Dispose(XrdSsiRequest &reqR) {reqR.Dispose();}

static XrdSsiErrInfo &ErrInfoRef(XrdSsiRequest *rP) {return rP->errInfo;}

static bool isaRetry(XrdSsiRequest *rP)
{if (rP->flags & XrdSsiRequest::isaRetry)
{rP->flags &= ~XrdSsiRequest::isaRetry;
return true;
}
return false;
}

static void onServer(XrdSsiRequest *rP) {rP->onClient = false;}

static XrdSsiRequest *Request(XrdSsiResponder *rP) {return rP->reqP;}
Expand Down
15 changes: 14 additions & 1 deletion src/XrdSsi/XrdSsiRequest.cc
Expand Up @@ -52,7 +52,7 @@ XrdSsiMutex ubMutex(XrdSsiMutex::Recursive);
XrdSsiRequest::XrdSsiRequest(const char *reqid, uint16_t tmo)
: reqID(reqid), rrMutex(&XrdSsi::ubMutex),
theRespond(0), rsvd1(0), epNode(0),
detTTL(0), tOut(0), onClient(true), rsvd2(0) {}
detTTL(0), tOut(0), onClient(true), flags(0) {}

/******************************************************************************/
/* Private: C l e a n U p */
Expand Down Expand Up @@ -185,3 +185,16 @@ void XrdSsiRequest::ReleaseRequestBuffer()
XrdSsiMutexMon lck(rrMutex);
RelRequestBuffer();
}

/******************************************************************************/
/* S e t R e t r y */
/******************************************************************************/

void XrdSsiRequest::SetRetry(bool onoff)
{

// Set flag as needed
//
if (onoff) flags |= isaRetry;
else flags &= ~isaRetry;
}
13 changes: 12 additions & 1 deletion src/XrdSsi/XrdSsiRequest.hh
Expand Up @@ -268,6 +268,16 @@ virtual void RelRequestBuffer() {}

inline void SetDetachTTL(uint32_t dttl) {detTTL = dttl;}

//-----------------------------------------------------------------------------
//! Set request retry notification. If a non-default value is desired, it must
//! be set prior to calling XrdSsiService::ProcessRequest(). This is a one-time
//! request and retry mode is turned off in the request object afterwards.
//!
//! @param onoff True to turn retry on and false to turn it off.
//-----------------------------------------------------------------------------

void SetRetry(bool onoff);

//-----------------------------------------------------------------------------
//! Set timeout for initiating the request. If a non-default value is desired,
//! it must be set prior to calling XrdSsiService::ProcessRequest().
Expand Down Expand Up @@ -302,6 +312,7 @@ const char *epNode;
uint32_t detTTL;
uint16_t tOut;
bool onClient;
char rsvd2;
char flags;
static const int isaRetry = 1;
};
#endif
9 changes: 7 additions & 2 deletions src/XrdSsi/XrdSsiSessReal.cc
Expand Up @@ -227,12 +227,17 @@ bool XrdSsiSessReal::Provision(XrdSsiRequest *reqP, const char *epURL)
EPNAME("Provision");
XrdCl::XRootDStatus epStatus;
XrdSsiMutexMon rHelp(&sessMutex);
XrdCl::OpenFlags::Flags oFlags = XrdCl::OpenFlags::Read;

// Set retry flag as appropriate
//
if (XrdSsiRRAgent::isaRetry(reqP)) oFlags |= XrdCl::OpenFlags::Refresh;

// Issue the open and if the open was started, return success.
//
DEBUG("Provisioning " <<epURL);
epStatus = epFile.Open((const std::string)epURL,
XrdCl::OpenFlags::Read, (XrdCl::Access::Mode)0,
epStatus = epFile.Open((const std::string)epURL, oFlags,
(XrdCl::Access::Mode)0,
(XrdCl::ResponseHandler *)this,
reqP->GetTimeOut());

Expand Down

0 comments on commit 68d807c

Please sign in to comment.