Răsfoiți Sursa

Avoid an iteration in flush function

The loop test ought to iterate again to end the loop but this is
only required if the socket contained more data than read.
Stéphane Raimbault 14 ani în urmă
părinte
comite
8057bbf45f
1 a modificat fișierele cu 1 adăugiri și 1 ștergeri
  1. 1 1
      src/modbus-tcp.c

+ 1 - 1
src/modbus-tcp.c

@@ -354,7 +354,7 @@ int _modbus_tcp_flush(modbus_t *ctx)
         if (ctx->debug && rc != -1) {
         if (ctx->debug && rc != -1) {
             printf("\n%d bytes flushed\n", rc);
             printf("\n%d bytes flushed\n", rc);
         }
         }
-    } while (rc > 0);
+    } while (rc == MODBUS_TCP_MAX_ADU_LENGTH);
 
 
     return rc;
     return rc;
 }
 }