Addresses issue where wsproxy utilizes 100% CPU. The process now rarely goes over 2%

This commit is contained in:
Kevin Chan 2010-05-11 04:45:46 +08:00 committed by Joel Martin
parent c539e4dcda
commit 3ec5d7c0a3
1 changed files with 4 additions and 0 deletions

View File

@ -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 sys, os, socket, ssl, time, traceback, re
import time
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
from select import select from select import select
@ -62,6 +64,8 @@ def proxy(client, target):
socks = [client, target] socks = [client, target]
while True: while True:
time.sleep(0.01) # 10ms
ins, outs, excepts = select(socks, socks, socks, 1) ins, outs, excepts = select(socks, socks, socks, 1)
if excepts: raise Exception("Socket exception") if excepts: raise Exception("Socket exception")