Commit 8057bbf45fd8dc70423271c14f50b099021b5cfe

Authored by Stéphane Raimbault
1 parent e2c9f5fd

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.
Showing 1 changed file with 1 additions and 1 deletions
src/modbus-tcp.c
... ... @@ -354,7 +354,7 @@ int _modbus_tcp_flush(modbus_t *ctx)
354 354 if (ctx->debug && rc != -1) {
355 355 printf("\n%d bytes flushed\n", rc);
356 356 }
357   - } while (rc > 0);
  357 + } while (rc == MODBUS_TCP_MAX_ADU_LENGTH);
358 358  
359 359 return rc;
360 360 }
... ...