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
This commit is contained in:
committed by
Douglas Clowes
parent
564989c722
commit
c24c60b0c3
@@ -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;
|
||||
@@ -388,6 +390,7 @@ static int AnstoHttpStatus(pHistDriver self,SConnection *pCon){ // pCon=NULL all
|
||||
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;retries<MAX_STATUS_READ_RETRIES&&retcode!=requiredstate;retries++)
|
||||
int retries,retcode,initialentry=1;
|
||||
for(retries=0;retries<MAX_STATUS_READ_RETRIES&&(initialentry||retcode!=requiredstate);retries++)
|
||||
{
|
||||
retcode=AnstoHttpStatus(self,NULL);
|
||||
retcode=AnstoHttpStatus(self,pCon);
|
||||
usleep(STATUS_READ_DELAY_US);
|
||||
initialentry=0;
|
||||
}
|
||||
return retcode;
|
||||
}
|
||||
@@ -430,10 +434,8 @@ static int AnstoHttpStart(pHistDriver self, SConnection *pCon){
|
||||
if(status != 1){
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
AnstoHttpStatusWithRetries(self,HWBusy);
|
||||
|
||||
return 1;
|
||||
AnstoHttpStatusWithRetries(self,HWBusy,pCon);
|
||||
return OKOK;
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static int AnstoHttpHalt(pHistDriver self){ // hmm, why isn't there a pCon like all the other ones...?
|
||||
@@ -448,9 +450,9 @@ static int AnstoHttpHalt(pHistDriver self){ // hmm, why isn't there a pCon like
|
||||
return HWFault;
|
||||
}
|
||||
|
||||
AnstoHttpStatusWithRetries(self,HWIdle);
|
||||
AnstoHttpStatusWithRetries(self,HWIdle,NULL); // no pCon available :(
|
||||
|
||||
return 1;
|
||||
return OKOK;
|
||||
}
|
||||
/*---------------------------------------------------------------------*/
|
||||
static int AnstoHttpPause(pHistDriver self,SConnection *pCon){
|
||||
@@ -466,9 +468,9 @@ static int AnstoHttpPause(pHistDriver self,SConnection *pCon){
|
||||
}
|
||||
pPriv->pause = 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,
|
||||
|
||||
Reference in New Issue
Block a user