From c24c60b0c39628469ee4823b0eb47e2ba65038ef Mon Sep 17 00:00:00 2001 From: Mark Lesha Date: Fri, 17 Nov 2006 11:54:08 +1100 Subject: [PATCH] MJL 17/11/06 Fixed status checking problem on slow servers; return HWRedo instead of HWBusy r1299 | mle | 2006-11-17 11:54:08 +1100 (Fri, 17 Nov 2006) | 2 lines --- site_ansto/anstohttp.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/site_ansto/anstohttp.c b/site_ansto/anstohttp.c index b75d9ca7..29db9651 100644 --- a/site_ansto/anstohttp.c +++ b/site_ansto/anstohttp.c @@ -366,7 +366,9 @@ static int AnstoHttpStatus(pHistDriver self,SConnection *pCon){ // pCon=NULL all } break; case ghttp_not_done: - return HWBusy; + // MJL this is not a problem, the server is just slow. + // return HWRedo not HWBusy (original) or falut + return HWRedo; break; case ghttp_done: pPriv->asyncRunning = 0; @@ -387,7 +389,8 @@ static int AnstoHttpStatus(pHistDriver self,SConnection *pCon){ // pCon=NULL all pPriv->errorCode = BADSTATUS; strncpy(pPriv->hmError,"ERROR: status does not contain DAQ field",511); return HWFault; - } + } + ///if (pCon) SCWrite(pCon,daqStatus,eError); // MJL DEBUG if(strstr(daqStatus,"Started") != NULL){ return HWBusy; } else if(strstr(daqStatus,"Paused") != NULL){ @@ -400,19 +403,20 @@ static int AnstoHttpStatus(pHistDriver self,SConnection *pCon){ // pCon=NULL all return HWFault; } - return HWIdle; + return HWFault; // shouldn't get here } #define MAX_STATUS_READ_RETRIES 50 #define STATUS_READ_DELAY_US 100000 // -static int AnstoHttpStatusWithRetries(pHistDriver self, int requiredstate) +static int AnstoHttpStatusWithRetries(pHistDriver self, int requiredstate,SConnection *pCon) // pCon=NULL allowed { - int retries,retcode=HWFault; - for(retries=0;retriespause = 1; - AnstoHttpStatusWithRetries(self,HWIdle); + AnstoHttpStatusWithRetries(self,HWIdle,pCon); - return 1; + return OKOK; } /*---------------------------------------------------------------------*/ static int AnstoHttpContinue(pHistDriver self, SConnection *pCon){ @@ -483,8 +485,8 @@ static int AnstoHttpContinue(pHistDriver self, SConnection *pCon){ return HWFault; } pPriv->pause = 0; - AnstoHttpStatusWithRetries(self,HWBusy); - return 1; + AnstoHttpStatusWithRetries(self,HWBusy,pCon); + return OKOK; } /*---------------------------------------------------------------------*/ static int AnstoHttpError(pHistDriver self, int *code, @@ -497,7 +499,7 @@ static int AnstoHttpError(pHistDriver self, int *code, strncpy(error,pPriv->hmError, errLen); *code = pPriv->errorCode; - return 1; + return OKOK; } /*--------------------------------------------------------------------*/ static int AnstoHttpFixIt(pHistDriver self, int code){ @@ -527,7 +529,7 @@ static int AnstoHttpGetData(pHistDriver self,SConnection *pCon){ * do noting, monitors are with the counter, histogram memory * caching and retrieval is handled via GetHistogram */ - return 1; + return OKOK; } /*-------------------------------------------------------------------*/ static int AnstoHttpGetHistogram(pHistDriver self, SConnection *pCon, @@ -563,7 +565,7 @@ static int AnstoHttpGetHistogram(pHistDriver self, SConnection *pCon, for(i = 0; i < (end - start); i++){ data[i] = ntohl(hmdata[i]); } - return 1; + return OKOK; } /*--------------------------------------------------------------------*/ static int AnstoHttpSetHistogram(pHistDriver self, SConnection *pCon,