don't skip initial data on tcp
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user