Dont try to poll for read when read buffer are full

This commit is contained in:
angt
2015-12-03 19:03:59 +01:00
parent cbdba8cba3
commit c458a4d86f

View File

@@ -880,9 +880,13 @@ int main (int argc, char **argv)
goto restart; goto restart;
FD_CLR(tun.fd, &rfds); FD_CLR(tun.fd, &rfds);
} else { } else {
if (!blks[blk_write].size)
FD_SET(tun.fd, &rfds); FD_SET(tun.fd, &rfds);
} }
buffer_shift(&sock.read);
if (buffer_write_size(&sock.read))
FD_SET(sock.fd, &rfds); FD_SET(sock.fd, &rfds);
struct timeval timeout = { struct timeval timeout = {
@@ -984,7 +988,6 @@ int main (int argc, char **argv)
} }
buffer_shift(&sock.write); buffer_shift(&sock.write);
buffer_shift(&sock.read);
if (FD_ISSET(sock.fd, &rfds)) { if (FD_ISSET(sock.fd, &rfds)) {
if (noquickack) if (noquickack)