From 828cccc2f3c838bc1927f25ae3325ff473ac01f5 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Mon, 5 Nov 2012 12:20:41 +1100 Subject: [PATCH] tcpmodbus.c Check for timeout when reading. Added more error checking. Some housekeeping to make it easier to follow the code, name changes and more descriptive comments. r3785 | ffr | 2012-11-05 12:20:41 +1100 (Mon, 05 Nov 2012) | 5 lines --- site_ansto/hardsup/sct_tcpmodbus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site_ansto/hardsup/sct_tcpmodbus.c b/site_ansto/hardsup/sct_tcpmodbus.c index 96ab19e5..ec3f6d65 100644 --- a/site_ansto/hardsup/sct_tcpmodbus.c +++ b/site_ansto/hardsup/sct_tcpmodbus.c @@ -304,6 +304,9 @@ int TCPMBReading(Ascon *a) { } if (allRead == 0 && aduLen >= (6 + RespLen)) { /* all of response has been read */ + /* FIXME If the Length field (ie RespLen) is wrong then we loop forever waiting for a response. + Can this be detected automatically (eg timeout) and reset? + */ allRead = 1; } if (allRead) {