From 44579ee8aabd3eba5c175ed1e47c9370c66dbd8b Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Sat, 27 Apr 2013 18:00:36 +1000 Subject: [PATCH] SICS-595: Added "busy" checks to the callbacks used by asynnet.c:anetRead() --- nread.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nread.c b/nread.c index e0ea5f07..8d742114 100644 --- a/nread.c +++ b/nread.c @@ -1075,8 +1075,10 @@ static int CommandDataCB(int handle, void *userData) if (pPtr[i] == '\r' || pPtr[i] == '\n') { self->state = SKIPTERM; if (!testAndInvokeInterrupt(self, handle)) { - status = - CostaTop(self->pCon->pStack, GetCharArray(self->command)); + if (self->pCon->iProtocolID == 0 && CostaLocked(self->pCon->pStack)) + status = 0; + else + status = CostaTop(self->pCon->pStack, GetCharArray(self->command)); if (!status) { SCWrite(self->pCon, "ERROR: Busy", eError); } @@ -1174,8 +1176,10 @@ static int ANETTelnetProcess(int handle, void *usData) case '\r': case '\n': if (!testAndInvokeInterrupt(self, handle)) { - status = - CostaTop(self->pCon->pStack, GetCharArray(self->command)); + if (self->pCon->iProtocolID == 0 && CostaLocked(self->pCon->pStack)) + status = 0; + else + status = CostaTop(self->pCon->pStack, GetCharArray(self->command)); if (!status) { SCWrite(self->pCon, "ERROR: Busy", eError); }