don't skip initial data on tcp
This commit is contained in:
@@ -328,13 +328,13 @@ result_t NetworkTransport::openInternal() {
|
|||||||
if (m_fd < 0) {
|
if (m_fd < 0) {
|
||||||
return RESULT_ERR_GENERIC_IO;
|
return RESULT_ERR_GENERIC_IO;
|
||||||
}
|
}
|
||||||
if (!m_udp) {
|
|
||||||
usleep(25000); // wait 25ms for potential initial garbage
|
|
||||||
}
|
|
||||||
int cnt;
|
int cnt;
|
||||||
symbol_t buf[MTU];
|
symbol_t buf[MTU];
|
||||||
int ioerr;
|
int ioerr;
|
||||||
while ((ioerr=ioctl(m_fd, FIONREAD, &cnt)) >= 0 && cnt > 1) {
|
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
|
// skip buffered input
|
||||||
ssize_t read = ::read(m_fd, &buf, MTU);
|
ssize_t read = ::read(m_fd, &buf, MTU);
|
||||||
if (read <= 0) {
|
if (read <= 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user