We found two issues when testing tproxy. Please find enclosed a quick patch to each, you may want to reformat or reorganise the code though.
Firstly the old import(name) syntax was deprecated, the code was changed to use the imp library.
Secondly, the class Worker is created before the fork. On my local version of gevent, it was causing the version in the parent, instead of the child to be used some of the time. The new code - only lightly tested - create a small class to store the information required which does not inherit from StreamServer
Hello,
We found two issues when testing tproxy. Please find enclosed a quick patch to each, you may want to reformat or reorganise the code though.
Firstly the old import(name) syntax was deprecated, the code was changed to use the imp library. Secondly, the class Worker is created before the fork. On my local version of gevent, it was causing the version in the parent, instead of the child to be used some of the time. The new code - only lightly tested - create a small class to store the information required which does not inherit from StreamServer
Regards
Thomas
diff -u /Users/thomas/source/others/proxy/tproxy/tproxy/arbiter.py tproxy/tproxy/arbiter.py --- /Users/thomas/source/others/proxy/tproxy/tproxy/arbiter.py 2011-11-29 15:10:36.000000000 +0000 +++ tproxy/tproxy/arbiter.py 2011-11-29 14:50:44.000000000 +0000 @@ -19,7 +19,15 @@ from .pidfile import Pidfile from .proxy import tcp_listener from .worker import Worker +from .workertmp import WorkerTmp
+class WorkerInfo(object):
class HaltServer(Exception): @@ -386,14 +394,17 @@
def spawn_worker(self): self.worker_age += 1
diff -u /Users/thomas/source/others/proxy/tproxy/tproxy/worker.py tproxy/tproxy/worker.py --- /Users/thomas/source/others/proxy/tproxy/tproxy/worker.py 2011-11-29 15:10:36.000000000 +0000 +++ tproxy/tproxy/worker.py 2011-11-29 14:50:25.000000000 +0000 @@ -14,7 +14,6 @@
from . import util from .proxy import ProxyServer -from .workertmp import WorkerTmp
class Worker(ProxyServer):
@@ -25,7 +24,7 @@
@@ -45,7 +44,7 @@ self.age = age self.ppid = ppid self.cfg = cfg
diff -u /Users/thomas/source/others/proxy/tproxy/tproxy/tools.py tproxy/tproxy/tools.py --- /Users/thomas/source/others/proxy/tproxy/tproxy/tools.py 2011-11-29 15:10:36.000000000 +0000 +++ tproxy/tproxy/tools.py 2011-11-29 15:14:27.000000000 +0000 @@ -3,6 +3,7 @@
This file is part of tproxy released under the MIT license.
See the NOTICE for more information.
+import imp
try: from importlibe import import_module @@ -40,5 +41,4 @@ break level += 1 name = _resolve_name(name[level:], package, level)