]> git.sesse.net Git - greproxy/blobdiff - tungre.cpp
Add README and license.
[greproxy] / tungre.cpp
index ea736fbc2fa600d78738da8c750e0ebd6a1fb77c..fb39982e9f8c216016b9ca2e4784718812497167 100644 (file)
@@ -37,9 +37,12 @@ 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_reorderer.possibly_adjust_tv(&tv);
+               tun_pacer.possibly_adjust_tv(&tv);
+               int ret = select(1024, &fds, NULL, NULL, &tv);
                if (ret == -1) {
                        perror("select");
                        continue;
@@ -51,5 +54,6 @@ int main(int argc, char **argv)
                if (FD_ISSET(tun.fd(), &fds)) {
                        tun.read_packet(&gre_pacer);
                }
+               tun_pacer.possibly_flush_packets();
        }
 }