From 6d49fd707af9a8ab4f023c6f754ae245969ee064 Mon Sep 17 00:00:00 2001 From: John Date: Sat, 24 Feb 2024 11:53:58 +0100 Subject: [PATCH] don't skip initial data on tcp --- src/lib/ebus/transport.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/ebus/transport.cpp b/src/lib/ebus/transport.cpp index 60932ff61..fb40ede6d 100644 --- a/src/lib/ebus/transport.cpp +++ b/src/lib/ebus/transport.cpp @@ -328,13 +328,13 @@ result_t NetworkTransport::openInternal() { if (m_fd < 0) { return RESULT_ERR_GENERIC_IO; } - if (!m_udp) { - usleep(25000); // wait 25ms for potential initial garbage - } int cnt; symbol_t buf[MTU]; int ioerr; while ((ioerr=ioctl(m_fd, FIONREAD, &cnt)) >= 0 && cnt > 1) { + if (!m_udp) { + break; // no need to skip anything on a fresh TCP connection + } // skip buffered input ssize_t read = ::read(m_fd, &buf, MTU); if (read <= 0) {