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;
|
break;
|
||||||
case ghttp_not_done:
|
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;
|
break;
|
||||||
case ghttp_done:
|
case ghttp_done:
|
||||||
pPriv->asyncRunning = 0;
|
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);
|
strncpy(pPriv->hmError,"ERROR: status does not contain DAQ field",511);
|
||||||
return HWFault;
|
return HWFault;
|
||||||
}
|
}
|
||||||
|
///if (pCon) SCWrite(pCon,daqStatus,eError); // MJL DEBUG
|
||||||
if(strstr(daqStatus,"Started") != NULL){
|
if(strstr(daqStatus,"Started") != NULL){
|
||||||
return HWBusy;
|
return HWBusy;
|
||||||
} else if(strstr(daqStatus,"Paused") != NULL){
|
} else if(strstr(daqStatus,"Paused") != NULL){
|
||||||
@@ -400,19 +403,20 @@ static int AnstoHttpStatus(pHistDriver self,SConnection *pCon){ // pCon=NULL all
|
|||||||
return HWFault;
|
return HWFault;
|
||||||
}
|
}
|
||||||
|
|
||||||
return HWIdle;
|
return HWFault; // shouldn't get here
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_STATUS_READ_RETRIES 50
|
#define MAX_STATUS_READ_RETRIES 50
|
||||||
#define STATUS_READ_DELAY_US 100000
|
#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;
|
int retries,retcode,initialentry=1;
|
||||||
for(retries=0;retries<MAX_STATUS_READ_RETRIES&&retcode!=requiredstate;retries++)
|
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);
|
usleep(STATUS_READ_DELAY_US);
|
||||||
|
initialentry=0;
|
||||||
}
|
}
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
@@ -430,10 +434,8 @@ static int AnstoHttpStart(pHistDriver self, SConnection *pCon){
|
|||||||
if(status != 1){
|
if(status != 1){
|
||||||
return HWFault;
|
return HWFault;
|
||||||
}
|
}
|
||||||
|
AnstoHttpStatusWithRetries(self,HWBusy,pCon);
|
||||||
AnstoHttpStatusWithRetries(self,HWBusy);
|
return OKOK;
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
static int AnstoHttpHalt(pHistDriver self){ // hmm, why isn't there a pCon like all the other ones...?
|
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;
|
return HWFault;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnstoHttpStatusWithRetries(self,HWIdle);
|
AnstoHttpStatusWithRetries(self,HWIdle,NULL); // no pCon available :(
|
||||||
|
|
||||||
return 1;
|
return OKOK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
static int AnstoHttpPause(pHistDriver self,SConnection *pCon){
|
static int AnstoHttpPause(pHistDriver self,SConnection *pCon){
|
||||||
@@ -466,9 +468,9 @@ static int AnstoHttpPause(pHistDriver self,SConnection *pCon){
|
|||||||
}
|
}
|
||||||
pPriv->pause = 1;
|
pPriv->pause = 1;
|
||||||
|
|
||||||
AnstoHttpStatusWithRetries(self,HWIdle);
|
AnstoHttpStatusWithRetries(self,HWIdle,pCon);
|
||||||
|
|
||||||
return 1;
|
return OKOK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
static int AnstoHttpContinue(pHistDriver self, SConnection *pCon){
|
static int AnstoHttpContinue(pHistDriver self, SConnection *pCon){
|
||||||
@@ -483,8 +485,8 @@ static int AnstoHttpContinue(pHistDriver self, SConnection *pCon){
|
|||||||
return HWFault;
|
return HWFault;
|
||||||
}
|
}
|
||||||
pPriv->pause = 0;
|
pPriv->pause = 0;
|
||||||
AnstoHttpStatusWithRetries(self,HWBusy);
|
AnstoHttpStatusWithRetries(self,HWBusy,pCon);
|
||||||
return 1;
|
return OKOK;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------*/
|
||||||
static int AnstoHttpError(pHistDriver self, int *code,
|
static int AnstoHttpError(pHistDriver self, int *code,
|
||||||
@@ -497,7 +499,7 @@ static int AnstoHttpError(pHistDriver self, int *code,
|
|||||||
|
|
||||||
strncpy(error,pPriv->hmError, errLen);
|
strncpy(error,pPriv->hmError, errLen);
|
||||||
*code = pPriv->errorCode;
|
*code = pPriv->errorCode;
|
||||||
return 1;
|
return OKOK;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
static int AnstoHttpFixIt(pHistDriver self, int code){
|
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
|
* do noting, monitors are with the counter, histogram memory
|
||||||
* caching and retrieval is handled via GetHistogram
|
* caching and retrieval is handled via GetHistogram
|
||||||
*/
|
*/
|
||||||
return 1;
|
return OKOK;
|
||||||
}
|
}
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
static int AnstoHttpGetHistogram(pHistDriver self, SConnection *pCon,
|
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++){
|
for(i = 0; i < (end - start); i++){
|
||||||
data[i] = ntohl(hmdata[i]);
|
data[i] = ntohl(hmdata[i]);
|
||||||
}
|
}
|
||||||
return 1;
|
return OKOK;
|
||||||
}
|
}
|
||||||
/*--------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------*/
|
||||||
static int AnstoHttpSetHistogram(pHistDriver self, SConnection *pCon,
|
static int AnstoHttpSetHistogram(pHistDriver self, SConnection *pCon,
|
||||||
|
|||||||
Reference in New Issue
Block a user