From 90719997ab8eaed005f99f2b5d24326a6959759a Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Tue, 2 Oct 2012 17:12:06 +1000 Subject: [PATCH] logg excess and unsolicited characters r3756 | dcl | 2012-10-02 17:12:06 +1000 (Tue, 02 Oct 2012) | 1 line --- asyncqueue.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/asyncqueue.c b/asyncqueue.c index 30c3b92d..1daf9a51 100644 --- a/asyncqueue.c +++ b/asyncqueue.c @@ -121,6 +121,12 @@ static int AQ_Reconnect(pAsyncQueue self) char line[132]; iRet = NETReconnect(self->pSock); + /* + * iRet can take the following values: + * -1: The request failed + * 0: The request is still in progress + * +1: The request succeeded + */ if (iRet <= 0) { snprintf(line, 132, "Disconnect on AsyncQueue '%s'", self->queue_name); SICSLogWrite(line, eStatus); @@ -347,13 +353,25 @@ static int MyCallback(void* context, int mode) } } if (i < nchars - 1) { - SICSLogWrite("ERROR: excess chars in AsyncQueue", eError); + char line[132]; + int excess = nchars - 1 - i; + struct timeval tv; + gettimeofday(&tv, NULL); + snprintf(line , sizeof(line)-1, "ERROR: %d excess chars in AsyncQueue", excess); + SICSLogWriteTime(line, eError, &tv); + SICSLogWriteHexTime(&reply[i], excess, eError, &tv); /* TODO: handle unsolicited */ } } else { - SICSLogWrite("ERROR: unsolicited input in AsyncQueue", eError); - /* TODO: handle unsolicited input */ + char line[132]; + int excess = nchars - 1 - i; + struct timeval tv; + gettimeofday(&tv, NULL); + snprintf(line , sizeof(line)-1, "ERROR: %d unsolicited chars in AsyncQueue", excess); + SICSLogWriteTime(line, eError, &tv); + SICSLogWriteHexTime(&reply[i], excess, eError, &tv); + /* TODO: handle unsolicited input */ } } }