From 3ec5d7c0a3c74cf123cbfa68747f66c917eb5e1f Mon Sep 17 00:00:00 2001 From: Kevin Chan Date: Tue, 11 May 2010 04:45:46 +0800 Subject: [PATCH] Addresses issue where wsproxy utilizes 100% CPU. The process now rarely goes over 2% --- wsproxy.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wsproxy.py b/wsproxy.py index 6f6296a0..0c2028f4 100755 --- a/wsproxy.py +++ b/wsproxy.py @@ -10,6 +10,8 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates ''' import sys, os, socket, ssl, time, traceback, re +import time + from base64 import b64encode, b64decode from select import select @@ -62,6 +64,8 @@ def proxy(client, target): socks = [client, target] while True: + time.sleep(0.01) # 10ms + ins, outs, excepts = select(socks, socks, socks, 1) if excepts: raise Exception("Socket exception")