diff options
author | John Van Ostrand <john@vanostrand.com> | 2017-09-05 17:07:55 -0400 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-06 08:30:21 -0700 |
commit | 928621357ca283905dd973b0f97d17b41b5841ea (patch) | |
tree | 043479159cdcb2b8033a1decabdd81b7057827cf /core | |
parent | 024b61ca04c8a18fc333101e234631e2f13933a9 (diff) | |
download | subsurface-928621357ca283905dd973b0f97d17b41b5841ea.tar.gz |
Changed backoff strategy for short reads.
Back off was exponential starting at 10ms, which for high baud
rate and no flow-control connections might cause buffer overrun.
This was causing problems when reading Cochran DCs, the hearbeat
byte was being missed.
Signed-off-by: John Van Ostrand <john@vanostrand.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/serial_ftdi.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/core/serial_ftdi.c b/core/serial_ftdi.c index f8cba95d3..297d0fa20 100644 --- a/core/serial_ftdi.c +++ b/core/serial_ftdi.c @@ -395,19 +395,12 @@ static dc_status_t serial_ftdi_read (dc_custom_io_t *io, void *data, size_t size ERROR (device->context, "%s", ftdi_get_error_string(device->ftdi_ctx)); return DC_STATUS_IO; //Error during read call. } else if (n == 0) { - // Exponential backoff. if (slept >= timeout) { ERROR(device->context, "%s", "FTDI read timed out."); return DC_STATUS_TIMEOUT; } serial_ftdi_sleep (device, backoff); slept += backoff; - backoff *= 2; - if (backoff + slept > timeout) - backoff = timeout - slept; - } else { - // Reset backoff to 1 on success. - backoff = 1; } nbytes += n; |