Fixing hang-on bug in lfgen protocol
r3690 | jgn | 2012-08-03 14:09:55 +1000 (Fri, 03 Aug 2012) | 1 line
This commit is contained in:
committed by
Douglas Clowes
parent
27a37364ab
commit
f2788d66cd
@@ -145,17 +145,20 @@ int LFGenReading(Ascon *a)
|
||||
// Read HEAD info
|
||||
do {
|
||||
ret = AsconReadChar(a->fd, &chr);
|
||||
if(ret<0) {
|
||||
AsconError(a, "AsconReadChar failed:", errno);
|
||||
if(ret<=0) {
|
||||
AsconError(a, "AsconReadChar failed:", 0);
|
||||
a->state = AsconReadDone;
|
||||
return 0;
|
||||
} else {
|
||||
HEAD = (BYTE)chr;
|
||||
}
|
||||
HEAD = (BYTE)chr;
|
||||
} while (HEAD!=0x96);
|
||||
|
||||
// read LEN info
|
||||
ret = AsconReadChar(a->fd, &chr);
|
||||
if(ret<0) {
|
||||
AsconError(a, "AsconReadChar failed:", errno);
|
||||
if(ret<=0) {
|
||||
AsconError(a, "AsconReadChar failed:", 0);
|
||||
a->state = AsconReadDone;
|
||||
return 0;
|
||||
}
|
||||
LEN = (BYTE)chr;
|
||||
@@ -173,8 +176,8 @@ int LFGenReading(Ascon *a)
|
||||
// read all other chars
|
||||
while(ind<LEN+2) {
|
||||
ret = AsconReadChar(a->fd, &chr);
|
||||
if (ret < 0) {
|
||||
AsconError(a, "AsconReadChar failed:", errno);
|
||||
if (ret <= 0) {
|
||||
AsconError(a, "AsconReadChar failed:", 0);
|
||||
a->state = AsconReadDone;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user