Commit 9c4bf37c authored by David Wilson's avatar David Wilson

Remove final vestiges of context.key.

parent 0ff65c97
......@@ -87,9 +87,8 @@ The script sent is simply the source code for :py:mod:`mitogen.core`, with a
single line suffixed to trigger execution of the
:py:meth:`mitogen.core.ExternalContext.main` function. The encoded arguments
to the main function include some additional details, such as the logging package
level that was active in the parent process, and a random secret key that may
later be used to generate HMAC signatures over the data frames that will be
exchanged after bootstrap.
level that was active in the parent process, and whether debugging or profiling
are enabled.
After the script source code is prepared, it is passed through
:py:func:`mitogen.master.minimize_source` to strip it of docstrings and
......
......@@ -8,7 +8,6 @@ import imp
import itertools
import logging
import os
import random
import select
import socket
import struct
......@@ -589,10 +588,9 @@ class Stream(BasicStream):
_input_buf = ''
_output_buf = ''
def __init__(self, router, remote_id, key, **kwargs):
def __init__(self, router, remote_id, **kwargs):
self._router = router
self.remote_id = remote_id
self.key = key
self.name = 'default'
self.construct(**kwargs)
......@@ -695,11 +693,10 @@ class Context(object):
"""
remote_name = None
def __init__(self, router, context_id, name=None, key=None):
def __init__(self, router, context_id, name=None):
self.router = router
self.context_id = context_id
self.name = name
self.key = key or ('%016x' % random.getrandbits(128))
def __reduce__(self):
return _unpickle_context, (self.context_id, self.name)
......@@ -1099,7 +1096,7 @@ class ExternalContext(object):
def _on_broker_shutdown(self):
self.channel.close()
def _setup_master(self, profiling, parent_id, context_id, key, in_fd, out_fd):
def _setup_master(self, profiling, parent_id, context_id, in_fd, out_fd):
if profiling:
enable_profiling()
self.broker = Broker()
......@@ -1111,7 +1108,7 @@ class ExternalContext(object):
self.parent = Context(self.router, parent_id, 'parent')
self.channel = Receiver(self.router, CALL_FUNCTION)
self.stream = Stream(self.router, parent_id, key)
self.stream = Stream(self.router, parent_id)
self.stream.name = 'parent'
self.stream.accept(in_fd, out_fd)
self.stream.receive_side.keep_alive = False
......@@ -1198,9 +1195,9 @@ class ExternalContext(object):
Message.pickled(e, dst_id=msg.src_id, handle=msg.reply_to)
)
def main(self, parent_id, context_id, key, debug, profiling, log_level,
def main(self, parent_id, context_id, debug, profiling, log_level,
in_fd=100, out_fd=1, core_src_fd=101, setup_stdio=True):
self._setup_master(profiling, parent_id, context_id, key, in_fd, out_fd)
self._setup_master(profiling, parent_id, context_id, in_fd, out_fd)
try:
try:
self._setup_logging(debug, log_level)
......
......@@ -361,7 +361,7 @@ def run(dest, router, args, deadline=None, econtext=None):
sock1, sock2 = socket.socketpair()
mitogen.core.set_cloexec(sock1.fileno())
stream = mitogen.core.Stream(router, context_id, fakessh.key)
stream = mitogen.core.Stream(router, context_id)
stream.name = 'fakessh'
stream.accept(sock1.fileno(), sock1.fileno())
router.register(fakessh, stream)
......@@ -380,7 +380,6 @@ def run(dest, router, args, deadline=None, econtext=None):
fp.write('ExternalContext().main%r\n' % ((
mitogen.context_id, # parent_id
context_id, # context_id
fakessh.key, # key
router.debug, # debug
router.profiling, # profiling
logging.getLogger().level, # log_level
......
......@@ -596,7 +596,6 @@ class Stream(mitogen.core.Stream):
source += '\nExternalContext().main%r\n' % ((
mitogen.context_id, # parent_id
self.remote_id, # context_id
self.key,
self.debug,
self.profiling,
LOG.level or logging.getLogger().level or logging.INFO,
......@@ -800,7 +799,7 @@ class Router(mitogen.core.Router):
def _connect(self, context_id, klass, name=None, **kwargs):
context = Context(self, context_id)
stream = klass(self, context.context_id, context.key, **kwargs)
stream = klass(self, context.context_id, **kwargs)
if name is not None:
stream.name = name
stream.connect()
......
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