- fixed errors occured after intendation command in fsm mechanism
This commit is contained in:
@ -65,6 +65,7 @@ static long AmiRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "level");
|
EaseWrite(eab, "level");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -82,6 +83,7 @@ static long AmiStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "cm");
|
EaseWrite(eab, "cm");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
|
11
ease.c
11
ease.c
@ -177,6 +177,15 @@ void EaseParHasChanged(void)
|
|||||||
parameterChange = 1;
|
parameterChange = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
void EasePchk(void *drv)
|
||||||
|
{
|
||||||
|
int pc = FsmPc();
|
||||||
|
if (pc > 0) {
|
||||||
|
ParPrintf(drv, eError, "ERROR: illegal line in fsm %d", pc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
void EaseSavePars(void)
|
void EaseSavePars(void)
|
||||||
{
|
{
|
||||||
@ -313,6 +322,7 @@ static long EaseSendIt(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(eab);
|
||||||
EaseWrite(eab, eab->sendCmd);
|
EaseWrite(eab, eab->sendCmd);
|
||||||
ParPrintf(eab, eWarning, "send cmd> %s", eab->sendCmd);
|
ParPrintf(eab, eWarning, "send cmd> %s", eab->sendCmd);
|
||||||
eab->sendCmd = NULL;
|
eab->sendCmd = NULL;
|
||||||
@ -354,6 +364,7 @@ static long EaseIdle(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(eab);
|
||||||
|
|
||||||
idle:
|
idle:
|
||||||
if (!EaseCheckDoit(eab))
|
if (!EaseCheckDoit(eab))
|
||||||
|
1
ease.h
1
ease.h
@ -87,6 +87,7 @@ void EaseSendPar(void *object);
|
|||||||
void EaseMsgPar(void *object);
|
void EaseMsgPar(void *object);
|
||||||
void EaseKillDriv(EaseDriv * ead);
|
void EaseKillDriv(EaseDriv * ead);
|
||||||
void EaseDrivPar(void *object, char *fmt, char *unit);
|
void EaseDrivPar(void *object, char *fmt, char *unit);
|
||||||
|
void EasePchk(void *drv);
|
||||||
void EaseParHasChanged(void);
|
void EaseParHasChanged(void);
|
||||||
void EaseStop(EaseBase * eab);
|
void EaseStop(EaseBase * eab);
|
||||||
int EaseCheckDoit(EaseBase * eab);
|
int EaseCheckDoit(EaseBase * eab);
|
||||||
|
@ -366,6 +366,7 @@ static long Euro2kRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
if (drv->script && drv->script[0] != '\0'
|
if (drv->script && drv->script[0] != '\0'
|
||||||
&& 0 != strcmp(drv->script, "0")) {
|
&& 0 != strcmp(drv->script, "0")) {
|
||||||
pTcl = InterpGetTcl(pServ->pSics);
|
pTcl = InterpGetTcl(pServ->pSics);
|
||||||
@ -479,6 +480,7 @@ static long Euro2kSet(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
loop:
|
loop:
|
||||||
upd = EaseNextUpdate(drv);
|
upd = EaseNextUpdate(drv);
|
||||||
if (upd == EASE_RUN) {
|
if (upd == EASE_RUN) {
|
||||||
@ -548,6 +550,7 @@ static long Euro2kStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
ModBusRequestValue(eab, 122, modBusInt);
|
ModBusRequestValue(eab, 122, modBusInt);
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
|
24
fsm.c
24
fsm.c
@ -49,6 +49,13 @@ void FsmSpeed(Fsm * task)
|
|||||||
task->till = time(NULL);
|
task->till = time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long FsmPc(void) {
|
||||||
|
if (fsm) {
|
||||||
|
return fsm->pc;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int FsmTaskHandler(Fsm * task)
|
int FsmTaskHandler(Fsm * task)
|
||||||
{
|
{
|
||||||
long line;
|
long line;
|
||||||
@ -74,6 +81,8 @@ int FsmTaskHandler(Fsm * task)
|
|||||||
}
|
}
|
||||||
fsm = task;
|
fsm = task;
|
||||||
task->pc = task->func(task->pc, task->obj);
|
task->pc = task->func(task->pc, task->obj);
|
||||||
|
if (task->pc > 0)
|
||||||
|
task->pc++; /* go to next line (case must be one line after return) */
|
||||||
while (callFunc) {
|
while (callFunc) {
|
||||||
assert(fsm->sp < MAXSTACK);
|
assert(fsm->sp < MAXSTACK);
|
||||||
fsm->stack[fsm->sp].pc = task->pc;
|
fsm->stack[fsm->sp].pc = task->pc;
|
||||||
@ -83,11 +92,14 @@ int FsmTaskHandler(Fsm * task)
|
|||||||
fsm->func = callFunc;
|
fsm->func = callFunc;
|
||||||
callFunc = NULL;
|
callFunc = NULL;
|
||||||
task->pc = fsm->func(fsm->pc, fsm->obj);
|
task->pc = fsm->func(fsm->pc, fsm->obj);
|
||||||
|
if (task->pc > 0)
|
||||||
|
task->pc++; /* go to next line (case must be one line after return) */
|
||||||
}
|
}
|
||||||
fsm = NULL;
|
fsm = NULL;
|
||||||
}
|
}
|
||||||
StatisticsEnd(old);
|
StatisticsEnd(old);
|
||||||
if (task->pc <= 0) {
|
if (task->pc <= 0) {
|
||||||
|
task->pc = 0;
|
||||||
if (task->sp == 0) {
|
if (task->sp == 0) {
|
||||||
return (task->obj != NULL); /* finish task only when explicitely stopped */
|
return (task->obj != NULL); /* finish task only when explicitely stopped */
|
||||||
}
|
}
|
||||||
@ -165,18 +177,6 @@ void FsmPause(Fsm * task, int pause)
|
|||||||
task->pause = pause;
|
task->pause = pause;
|
||||||
}
|
}
|
||||||
|
|
||||||
long FsmCallOld(long pc, FsmFunc func)
|
|
||||||
{
|
|
||||||
assert(fsm);
|
|
||||||
assert(fsm->sp < MAXSTACK);
|
|
||||||
fsm->stack[fsm->sp].pc = pc;
|
|
||||||
fsm->stack[fsm->sp].func = fsm->func;
|
|
||||||
fsm->sp++;
|
|
||||||
fsm->func = func;
|
|
||||||
fsm->pc = 0;
|
|
||||||
return fsm->func(fsm->pc, fsm->obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FsmCall(FsmFunc func)
|
void FsmCall(FsmFunc func)
|
||||||
{
|
{
|
||||||
assert(fsm);
|
assert(fsm);
|
||||||
|
6
fsm.h
6
fsm.h
@ -51,6 +51,9 @@ Fsm *FsmStartTask(void *obj, FsmHandler handler, FsmFunc func, char *name);
|
|||||||
void FsmRestartTask(Fsm * task, FsmFunc func);
|
void FsmRestartTask(Fsm * task, FsmFunc func);
|
||||||
/* restart a stopped task */
|
/* restart a stopped task */
|
||||||
|
|
||||||
|
long FsmPc(void);
|
||||||
|
/* check current pc (used in EasePchk called in first step in fsm functions) */
|
||||||
|
|
||||||
int FsmTaskHandler(Fsm * task);
|
int FsmTaskHandler(Fsm * task);
|
||||||
/* this is the task handler.
|
/* this is the task handler.
|
||||||
the argument should be the pointer obtained from FsmStartTask
|
the argument should be the pointer obtained from FsmStartTask
|
||||||
@ -68,9 +71,6 @@ void FsmKill(void *task);
|
|||||||
void FsmPause(Fsm * task, int pause);
|
void FsmPause(Fsm * task, int pause);
|
||||||
/* pause=1: pause task, pause=0: continue task */
|
/* pause=1: pause task, pause=0: continue task */
|
||||||
|
|
||||||
long FsmCallOld(long pc, FsmFunc func);
|
|
||||||
/* these functions are used in fsm macros and must not be called directly */
|
|
||||||
|
|
||||||
void FsmCall(FsmFunc func);
|
void FsmCall(FsmFunc func);
|
||||||
|
|
||||||
void FsmWait(long delay);
|
void FsmWait(long delay);
|
||||||
|
@ -224,6 +224,7 @@ static long HaakeRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "B");
|
EaseWrite(eab, "B");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -276,6 +277,7 @@ static long HaakeStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "V");
|
EaseWrite(eab, "V");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -319,6 +321,7 @@ static long HaakeSet(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
upd = EaseNextUpdate(drv);
|
upd = EaseNextUpdate(drv);
|
||||||
switch (upd) {
|
switch (upd) {
|
||||||
case EASE_RUN:
|
case EASE_RUN:
|
||||||
|
@ -344,6 +344,7 @@ static long IghRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "X");
|
EaseWrite(eab, "X");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -563,6 +564,7 @@ static long IghStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "V");
|
EaseWrite(eab, "V");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -601,6 +603,7 @@ static long IghSet(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "C3");
|
EaseWrite(eab, "C3");
|
||||||
drv->remote = 2;
|
drv->remote = 2;
|
||||||
loop:
|
loop:
|
||||||
|
@ -130,6 +130,7 @@ static long IlmRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "X");
|
EaseWrite(eab, "X");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -195,6 +196,7 @@ static long IlmStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "V");
|
EaseWrite(eab, "V");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
|
@ -301,6 +301,7 @@ static long IpsRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "X");
|
EaseWrite(eab, "X");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
|
@ -464,6 +464,7 @@ static long ItcRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "X");
|
EaseWrite(eab, "X");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -733,6 +734,7 @@ static long ItcStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "V");
|
EaseWrite(eab, "V");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -782,6 +784,7 @@ static long ItcSetTemp(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
if (drv->controlChan == 0) {
|
if (drv->controlChan == 0) {
|
||||||
ParPrintf(drv, eError, "no control channel selected");
|
ParPrintf(drv, eError, "no control channel selected");
|
||||||
goto quit;
|
goto quit;
|
||||||
@ -849,6 +852,7 @@ static long ItcSetGas(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
if (drv->gasMode != 1 && drv->gasMode != 2) {
|
if (drv->gasMode != 1 && drv->gasMode != 2) {
|
||||||
ParPrintf(drv, eError, "gasMode must be set to manual or auto");
|
ParPrintf(drv, eError, "gasMode must be set to manual or auto");
|
||||||
goto quit;
|
goto quit;
|
||||||
@ -892,6 +896,7 @@ static long ItcSetHtr(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
if (drv->a == 0)
|
if (drv->a == 0)
|
||||||
goto skipmode;
|
goto skipmode;
|
||||||
EaseWrite(eab, "A0");
|
EaseWrite(eab, "A0");
|
||||||
@ -921,6 +926,7 @@ static long ItcSet(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "C3");
|
EaseWrite(eab, "C3");
|
||||||
loop:
|
loop:
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
|
@ -137,6 +137,7 @@ static long LinaRead(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "XY.");
|
EaseWrite(eab, "XY.");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -160,6 +161,7 @@ static long LinaStart(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "ID");
|
EaseWrite(eab, "ID");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -190,6 +192,7 @@ static long LinaSet(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
/*
|
/*
|
||||||
snprintf(cmd, sizeof cmd, "SETP %.5g;SETP?", drv->d.targetValue);
|
snprintf(cmd, sizeof cmd, "SETP %.5g;SETP?", drv->d.targetValue);
|
||||||
EaseWrite(eab, cmd);
|
EaseWrite(eab, cmd);
|
||||||
|
@ -284,6 +284,9 @@ static long Lsc370Read(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
if (pc != 0) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
drv->index = 0;
|
drv->index = 0;
|
||||||
chanLoop:
|
chanLoop:
|
||||||
if (drv->channel[drv->index] == 0) {
|
if (drv->channel[drv->index] == 0) {
|
||||||
@ -393,6 +396,7 @@ static long Lsc370Start(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "*IDN?");
|
EaseWrite(eab, "*IDN?");
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
@ -423,6 +427,7 @@ static long Lsc370Set(long pc, void *object)
|
|||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
default: /* FSM BEGIN ****************************** */
|
default: /* FSM BEGIN ****************************** */
|
||||||
|
EasePchk(drv);
|
||||||
EaseWrite(eab, "MODE 1;MODE?"); /* remote mode */
|
EaseWrite(eab, "MODE 1;MODE?"); /* remote mode */
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
|
@ -31,7 +31,7 @@ static int configRequest(Ascon * a)
|
|||||||
|
|
||||||
request = CreateDynString(64, 64);
|
request = CreateDynString(64, 64);
|
||||||
if (request == NULL) {
|
if (request == NULL) {
|
||||||
AsconError(a, "Out of memory", 122);
|
AsconError(a, "Out of memory", 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
DynStringConcat(request, "http://");
|
DynStringConcat(request, "http://");
|
||||||
@ -44,7 +44,7 @@ static int configRequest(Ascon * a)
|
|||||||
ghttp_set_type(pHttp->request, ghttp_type_get);
|
ghttp_set_type(pHttp->request, ghttp_type_get);
|
||||||
ghttp_set_header(pHttp->request, "connection", "keep-alive");
|
ghttp_set_header(pHttp->request, "connection", "keep-alive");
|
||||||
if (ghttp_set_uri(pHttp->request, uri) < 0) {
|
if (ghttp_set_uri(pHttp->request, uri) < 0) {
|
||||||
AsconError(a, "Bad URL", a->state);
|
AsconError(a, "Bad URL", 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (pHttp->userName != NULL && pHttp->password != NULL) {
|
if (pHttp->userName != NULL && pHttp->password != NULL) {
|
||||||
@ -68,11 +68,11 @@ static void handleReply(Ascon * a)
|
|||||||
pPtr = ghttp_get_body(pHttp->request);
|
pPtr = ghttp_get_body(pHttp->request);
|
||||||
len = ghttp_get_body_len(pHttp->request);
|
len = ghttp_get_body_len(pHttp->request);
|
||||||
if (strstr(pPtr, "ERROR") != NULL) {
|
if (strstr(pPtr, "ERROR") != NULL) {
|
||||||
AsconError(a, pPtr, a->state);
|
AsconError(a, pPtr, 0);
|
||||||
DynStringConcat(a->rdBuffer, pPtr);
|
DynStringConcat(a->rdBuffer, pPtr);
|
||||||
} else if (strstr(pPtr, "Authentication Error") != NULL) {
|
} else if (strstr(pPtr, "Authentication Error") != NULL) {
|
||||||
DynStringConcat(a->rdBuffer, pPtr);
|
DynStringConcat(a->rdBuffer, pPtr);
|
||||||
AsconError(a, pPtr, a->state);
|
AsconError(a, pPtr, 0);
|
||||||
} else {
|
} else {
|
||||||
pType = (char *) ghttp_get_header(pHttp->request, "Content-Type");
|
pType = (char *) ghttp_get_header(pHttp->request, "Content-Type");
|
||||||
if (strstr(pType, "sinqhm") == NULL) {
|
if (strstr(pType, "sinqhm") == NULL) {
|
||||||
@ -126,7 +126,7 @@ static int HttpHandler(Ascon * a)
|
|||||||
status = ghttp_process(pHttp->request);
|
status = ghttp_process(pHttp->request);
|
||||||
}
|
}
|
||||||
if (status == ghttp_error) {
|
if (status == ghttp_error) {
|
||||||
AsconError(a, "Server error", 123);
|
AsconError(a, "Server error", 0);
|
||||||
DynStringConcat(a->rdBuffer, "Server error");
|
DynStringConcat(a->rdBuffer, "Server error");
|
||||||
a->state = AsconReadDone;
|
a->state = AsconReadDone;
|
||||||
} else {
|
} else {
|
||||||
@ -149,7 +149,7 @@ static int HttpHandler(Ascon * a)
|
|||||||
a->state = AsconReading;
|
a->state = AsconReading;
|
||||||
} else {
|
} else {
|
||||||
if (DoubleTime() > a->start + a->timeout) {
|
if (DoubleTime() > a->start + a->timeout) {
|
||||||
AsconError(a, " read timeout", 0);
|
AsconError(a, "read timeout", 0);
|
||||||
a->state = AsconTimeout;
|
a->state = AsconTimeout;
|
||||||
/* this to clear the line */
|
/* this to clear the line */
|
||||||
ghttp_close(pHttp->request);
|
ghttp_close(pHttp->request);
|
||||||
@ -169,7 +169,7 @@ static int HttpHandler(Ascon * a)
|
|||||||
switch (status) {
|
switch (status) {
|
||||||
case ghttp_not_done:
|
case ghttp_not_done:
|
||||||
if (DoubleTime() > a->start + a->timeout) {
|
if (DoubleTime() > a->start + a->timeout) {
|
||||||
AsconError(a, " read timeout", 0);
|
AsconError(a, "read timeout", 0);
|
||||||
a->state = AsconTimeout;
|
a->state = AsconTimeout;
|
||||||
/* this to clear the line */
|
/* this to clear the line */
|
||||||
ghttp_close(pHttp->request);
|
ghttp_close(pHttp->request);
|
||||||
@ -188,7 +188,7 @@ static int HttpHandler(Ascon * a)
|
|||||||
configRequest(a);
|
configRequest(a);
|
||||||
status = ghttp_process(pHttp->request);
|
status = ghttp_process(pHttp->request);
|
||||||
if (status == ghttp_error) {
|
if (status == ghttp_error) {
|
||||||
AsconError(a, "Server error", a->state);
|
AsconError(a, "Server error", 0);
|
||||||
DynStringConcat(a->rdBuffer, "Server error");
|
DynStringConcat(a->rdBuffer, "Server error");
|
||||||
a->state = AsconReadDone;
|
a->state = AsconReadDone;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user