Skip to content

Commit a6848d2

Browse files
committed
tests: don't kill unit test server on RTU bad-CRC frame
The fall-through called modbus_reply with rc == -1 on a stale query, which failed and broke the loop, contrary to the comment intent
1 parent 6094e00 commit a6848d2

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

tests/unit-test-server.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,13 @@ int main(int argc, char *argv[])
143143
/* Filtered queries return 0 */
144144
} while (rc == 0);
145145

146-
/* The connection is not closed on errors which require on reply such as
146+
/* The connection is not closed on errors which require no reply such as
147147
bad CRC in RTU. */
148-
if (rc == -1 && errno != EMBBADCRC) {
148+
if (rc == -1) {
149+
if (errno == EMBBADCRC) {
150+
/* Wait for the next request, the query is unusable */
151+
continue;
152+
}
149153
/* Quit */
150154
break;
151155
}

0 commit comments

Comments
 (0)