From ac04939284985765884515ed86c076c32a1db811 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Wed, 29 Oct 2014 16:03:48 +0100 Subject: [PATCH] - do not swallow bytes in buffer before sending an empty line (binprot.c) - state after EaseStop changed to offline instead of notconnected --- binprot.c | 7 ++++++- ease.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/binprot.c b/binprot.c index dcae992..f0ce52f 100644 --- a/binprot.c +++ b/binprot.c @@ -357,7 +357,12 @@ int BinHandler(Ascon *a) { } while (res == 1); p->nextFmt = str + pos; a->wrPos = 0; - a->state = AsconWriting; + if (GetDynStringLength(a->wrBuffer) == 0) { + /* prevent to swallow "garbage" */ + a->state = AsconWriteDone; + } else { + a->state = AsconWriting; + } a->lineCount = 0; return 1; case AsconReadStart: diff --git a/ease.c b/ease.c index 036696d..a434723 100644 --- a/ease.c +++ b/ease.c @@ -61,7 +61,7 @@ void EaseStop(EaseBase * eab, char *reason) snprintf(eab->msg, sizeof eab->msg, "offline (%s)", reason); ParPrintf(eab, eLogError, "ERROR: %s", eab->msg); } - eab->state = EASE_notconnected; + eab->state = EASE_offline; } /*----------------------------------------------------------------------------*/ @@ -754,7 +754,7 @@ static int EaseInit(SConnection * pCon, EaseBase * eab, int argc, : */ - int port=0, iRet, i; + int port, iRet, i; rs232 *ser; char *colon, *host; char buf[64];