diff --git a/chopsticks/bubble.py b/chopsticks/bubble.py index fbd0e14..f018f60 100644 --- a/chopsticks/bubble.py +++ b/chopsticks/bubble.py @@ -57,8 +57,6 @@ def exec_(_code_, _globs_=None, _locs_=None): import codecs -utf8_decode = codecs.getdecoder('utf8') - outqueue = Queue(maxsize=10) tasks = Queue() done = object() @@ -348,7 +346,8 @@ def handle_start(req_id, host, path, depthlimit): MSG_PACK = 2 -<< PENCODE >> +# The source code from chopsticks.pencode will be substituted here +{{ PENCODE }} def send_msg(op, req_id, data): diff --git a/chopsticks/tunnel.py b/chopsticks/tunnel.py index ccb8193..9aff926 100644 --- a/chopsticks/tunnel.py +++ b/chopsticks/tunnel.py @@ -83,12 +83,14 @@ class DepthLimitExceeded(Exception): """The recursive tunnel depth limit was hit.""" +# Load/construct the bubble code try: + # If this is the remote side, we have the bubble code in __main__.__bubble bubble = sys.modules['__main__'].__bubble except (AttributeError, KeyError): pencode = pkgutil.get_data('chopsticks', 'pencode.py') bubble = pkgutil.get_data('chopsticks', 'bubble.py') - bubble = bubble.replace(b'<< PENCODE >>', pencode) + bubble = bubble.replace(b'{{ PENCODE }}', pencode) del pencode