- fixed error handling
This commit is contained in:
16
ease.c
16
ease.c
@ -261,9 +261,8 @@ int EaseHandler(EaseBase * eab)
|
||||
return 0;
|
||||
}
|
||||
if (eab->state == EASE_expect) {
|
||||
if (eab->cmdtime != 0 && time(NULL) > eab->cmdtime + eab->p.period * 2) {
|
||||
snprintf(eab->msg, sizeof eab->msg, "no response since %d sec",
|
||||
(int) (time(NULL) - eab->cmdtime));
|
||||
if (eab->cmdtime != 0 && time(NULL) > eab->cmdtime + eab->p.period) {
|
||||
snprintf(eab->msg, sizeof eab->msg, "no response");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -299,8 +298,7 @@ int EaseHandler(EaseBase * eab)
|
||||
if (eab->tmo > 20) {
|
||||
eab->tmo = 20;
|
||||
}
|
||||
snprintf(eab->msg, sizeof eab->msg,
|
||||
"get a first answer from %s", eab->p.name);
|
||||
eab->msg[0] = '\0';
|
||||
eab->state = EASE_idle;
|
||||
}
|
||||
}
|
||||
@ -430,7 +428,7 @@ static long EaseIdle(long pc, void *object)
|
||||
gettimeofday(&tm, NULL);
|
||||
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__;
|
||||
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 */
|
||||
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);
|
||||
EaseStop(eab, NULL);
|
||||
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;
|
||||
EaseWriteError(eab);
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
10
pardef.c
10
pardef.c
@ -27,6 +27,7 @@ Markus Zolliker, March 2005
|
||||
#define BADLOG -6
|
||||
#define UNKPAR -7
|
||||
#define PARUNDEF -8
|
||||
#define ERRCMD -9
|
||||
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
ctx->returnValue = 1;
|
||||
return cmd(ctx->obj, userarg, ctx->argc, ctx->argv);
|
||||
iret = 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