X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=tungre.cpp;fp=tungre.cpp;h=55bd973602b888bbf57e5e5c63ce8c399667c422;hb=3c6c8f4a2bfa4bc729a35c579922e17033309bf3;hp=ea736fbc2fa600d78738da8c750e0ebd6a1fb77c;hpb=0d7a8406547587b7b1adad9374b4f4985f49dd84;p=greproxy diff --git a/tungre.cpp b/tungre.cpp index ea736fb..55bd973 100644 --- a/tungre.cpp +++ b/tungre.cpp @@ -37,9 +37,11 @@ int main(int argc, char **argv) fd_set fds; FD_ZERO(&fds); for ( ;; ) { + timeval tv = { 1, 0 }; FD_SET(gre.fd(), &fds); FD_SET(tun.fd(), &fds); - int ret = select(1024, &fds, NULL, NULL, NULL); + tun_pacer.possibly_adjust_tv(&tv); + int ret = select(1024, &fds, NULL, NULL, &tv); if (ret == -1) { perror("select"); continue; @@ -51,5 +53,6 @@ int main(int argc, char **argv) if (FD_ISSET(tun.fd(), &fds)) { tun.read_packet(&gre_pacer); } + tun_pacer.possibly_flush_packets(); } }