SICS-593: Return 0 from the AsconReading state to ensure that SICS
progresses through tasks.
This commit is contained in:
@@ -41,6 +41,21 @@ int GalilReading(Ascon *a) {
|
||||
char chr, ch[2];
|
||||
|
||||
ret = AsconReadChar(a->fd, &chr);
|
||||
if (ret > 0) {
|
||||
a->start = DoubleTime();
|
||||
} else if (ret < 0) {
|
||||
AsconError(a, "ASC5", errno)
|
||||
return 0;
|
||||
} else if (ret == 0) {
|
||||
if (a->timeout > 0) {
|
||||
if (DoubleTime() - a->start > a->timeout) {
|
||||
AsconError(a, "read timeout", 0);
|
||||
/* a->state = AsconTimeout; */
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (chr) {
|
||||
case ' ':
|
||||
return AsconStdHandler(a);
|
||||
@@ -52,12 +67,12 @@ int GalilReading(Ascon *a) {
|
||||
a->state = AsconWriteStart;
|
||||
a->responseValid=0;
|
||||
a->wrPos = 0;
|
||||
return 1;
|
||||
return 0;
|
||||
break;
|
||||
case ':':
|
||||
DynStringReplace(a->rdBuffer, "OK",0);
|
||||
a->state = AsconReadDone;
|
||||
return 1;
|
||||
return 0;
|
||||
break;
|
||||
default:
|
||||
/* Check for first digit of errorcode followed by error message */
|
||||
@@ -68,9 +83,10 @@ int GalilReading(Ascon *a) {
|
||||
DynStringInsert(a->rdBuffer, ch, 0);
|
||||
a->state = AsconReadDone;
|
||||
AsconError(a, GetCharArray(a->rdBuffer), 0);
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/* Return 1 to read next char befor progressing to next task */
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user