Ver Fonte

New error message in debug mode for wrong message length

Stéphane Raimbault há 14 anos atrás
pai
commit
311137cf70
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      src/modbus.c

+ 5 - 0
src/modbus.c

@@ -497,6 +497,11 @@ static int receive_msg_req(modbus_t *ctx, uint8_t *req, uint8_t *rsp)
         _error_print(ctx, NULL);
         rc = -1;
     } else {
+        if (ctx->debug) {
+            fprintf(stderr,
+                    "Message length not corresponding to the computed length (%d != %d)\n",
+                    rc, rsp_length_computed);
+        }
         errno = EMBBADDATA;
         rc = -1;
     }