don't skip initial data on tcp

This commit is contained in:
John
2024-02-24 11:53:58 +01:00
parent 741860feb7
commit 6d49fd707a
+3 -3
View File
@@ -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) {