benoitc / tproxy

simple TCP routing proxy
Other
268 stars 38 forks source link

patch #4

Closed thomas-mangin closed 2 years ago

thomas-mangin commented 12 years ago

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):

@@ -25,7 +24,7 @@

 PIPE = []

@@ -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)

thomas-mangin commented 2 years ago

As we are now in 2022 .. I will take this as wont-fix. 👋