Commit 3ec5d7c0 authored by Kevin Chan's avatar Kevin Chan Committed by Joel Martin

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

parent c539e4dc
...@@ -10,6 +10,8 @@ as taken from http://docs.python.org/dev/library/ssl.html#certificates ...@@ -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): ...@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment