- fixed error handling
This commit is contained in:
16
ease.c
16
ease.c
@ -261,9 +261,8 @@ int EaseHandler(EaseBase * eab)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (eab->state == EASE_expect) {
|
if (eab->state == EASE_expect) {
|
||||||
if (eab->cmdtime != 0 && time(NULL) > eab->cmdtime + eab->p.period * 2) {
|
if (eab->cmdtime != 0 && time(NULL) > eab->cmdtime + eab->p.period) {
|
||||||
snprintf(eab->msg, sizeof eab->msg, "no response since %d sec",
|
snprintf(eab->msg, sizeof eab->msg, "no response");
|
||||||
(int) (time(NULL) - eab->cmdtime));
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -299,8 +298,7 @@ int EaseHandler(EaseBase * eab)
|
|||||||
if (eab->tmo > 20) {
|
if (eab->tmo > 20) {
|
||||||
eab->tmo = 20;
|
eab->tmo = 20;
|
||||||
}
|
}
|
||||||
snprintf(eab->msg, sizeof eab->msg,
|
eab->msg[0] = '\0';
|
||||||
"get a first answer from %s", eab->p.name);
|
|
||||||
eab->state = EASE_idle;
|
eab->state = EASE_idle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,7 +428,7 @@ static long EaseIdle(long pc, void *object)
|
|||||||
gettimeofday(&tm, NULL);
|
gettimeofday(&tm, NULL);
|
||||||
printf("stop %s %f\n", eab->evc->pName, tm.tv_usec / 1e6);
|
printf("stop %s %f\n", eab->evc->pName, tm.tv_usec / 1e6);
|
||||||
*/
|
*/
|
||||||
FsmWait(1);
|
/* FsmWait(1); do we really need that? -- remove for faster response to send */
|
||||||
return __LINE__;
|
return __LINE__;
|
||||||
case __LINE__: /**********************************/
|
case __LINE__: /**********************************/
|
||||||
/*
|
/*
|
||||||
@ -1017,7 +1015,7 @@ int EaseRestartWrapper(void *object, void *userarg, int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
eab->cmdtime = 0; /* means: this is not a repeated restart */
|
eab->cmdtime = 0; /* means: this is not a repeated restart */
|
||||||
EaseRestart(eab);
|
EaseRestart(eab);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
@ -1029,7 +1027,7 @@ int EaseDisconnectWrapper(void *object, void *userarg, int argc, char *argv[])
|
|||||||
ParPrintf(object, eWarning, "%s", eab->msg);
|
ParPrintf(object, eWarning, "%s", eab->msg);
|
||||||
EaseStop(eab, NULL);
|
EaseStop(eab, NULL);
|
||||||
eab->state = EASE_offline;
|
eab->state = EASE_offline;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
@ -1090,7 +1088,7 @@ int EaseSend(void *object, void *userarg, int argc, char *argv[])
|
|||||||
eab->errCode = iret;
|
eab->errCode = iret;
|
||||||
EaseWriteError(eab);
|
EaseWriteError(eab);
|
||||||
}
|
}
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
10
pardef.c
10
pardef.c
@ -27,6 +27,7 @@ Markus Zolliker, March 2005
|
|||||||
#define BADLOG -6
|
#define BADLOG -6
|
||||||
#define UNKPAR -7
|
#define UNKPAR -7
|
||||||
#define PARUNDEF -8
|
#define PARUNDEF -8
|
||||||
|
#define ERRCMD -9
|
||||||
|
|
||||||
typedef enum { NO_OP, FMT_OP, SET_OP, GET_OP, INIT_OP } ParOp;
|
typedef enum { NO_OP, FMT_OP, SET_OP, GET_OP, INIT_OP } ParOp;
|
||||||
|
|
||||||
@ -1390,8 +1391,13 @@ int ParCmd(ParCommand cmd, void *userarg)
|
|||||||
ctx->action = PAR_NOOP;
|
ctx->action = PAR_NOOP;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ctx->returnValue = 1;
|
iret = cmd(ctx->obj, userarg, ctx->argc, ctx->argv);
|
||||||
return cmd(ctx->obj, userarg, ctx->argc, ctx->argv);
|
if (iret == 0) {
|
||||||
|
ctx->returnValue = ERRCMD;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
ctx->returnValue = iret;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
Reference in New Issue
Block a user