Explorar o código

New error message in debug mode for wrong message length

Stéphane Raimbault %!s(int64=14) %!d(string=hai) anos
pai
achega
311137cf70
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  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;
     }