Explorar el Código

Fix unit test of report slave ID in RTU

Stéphane Raimbault hace 14 años
padre
commit
614ff1dc36
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/modbus.c

+ 4 - 2
src/modbus.c

@@ -344,8 +344,10 @@ static int receive_msg(modbus_t *ctx, int msg_length_computed,
                 /* It's useless to check the value of
                    msg_length_computed in this case (only
                    defined values are used). */
-                state = DATA;
-                break;
+                if (length_to_read != 0) {
+                    state = DATA;
+                    break;
+                } /* else switch straight to DATA */
             case DATA:
                 length_to_read = compute_data_length(ctx, msg);
                 msg_length_computed += length_to_read;