From cd51a49eaf8fe7f83f6bc99d2ba6acb51267e5b2 Mon Sep 17 00:00:00 2001 From: Claudio-Daniel Freire Date: Mon, 18 Apr 2011 18:16:11 +0200 Subject: [PATCH] Fix tun_connect not to use 100% CPU (by only waiting for write-ready sockets that really need to write) --- scripts/tun_connect.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/tun_connect.py b/scripts/tun_connect.py index ba74a6ad..c416557e 100644 --- a/scripts/tun_connect.py +++ b/scripts/tun_connect.py @@ -310,7 +310,12 @@ def tun_fwd(tun, remote): fwbuf = "" bkbuf = "" while not abortme: - rdrdy, wrdy, errs = select.select((tun,remote),(tun,remote),(tun,remote),1) + wset = [] + if packetReady(bkbuf): + wset.append(tun) + if packetReady(fwbuf): + wset.append(remote) + rdrdy, wrdy, errs = select.select((tun,remote),wset,(tun,remote),1) # check for errors if errs: -- 2.47.0