Commit b158259c authored by David Wilson's avatar David Wilson

Split up parent and master modules

Knocks 4kb off network footprint for a proxy connection.
parent 5f2fa2cd
......@@ -30,7 +30,6 @@ import inspect
import logging
import os
import shutil
import signal
import socket
import subprocess
import sys
......@@ -39,6 +38,7 @@ import threading
import mitogen.core
import mitogen.master
import mitogen.parent
from mitogen.core import LOG, IOLOG
......@@ -123,7 +123,7 @@ class Process(object):
mitogen.core.listen(self.pump, 'receive', self._on_pump_receive)
if proc:
pmon = mitogen.master.ProcessMonitor.instance()
pmon = mitogen.parent.ProcessMonitor.instance()
pmon.add(proc.pid, self._on_proc_exit)
def __repr__(self):
......@@ -313,7 +313,7 @@ def _fakessh_main(dest_context_id, econtext):
@mitogen.core.takes_router
def run(dest, router, args, deadline=None, econtext=None):
if econtext is not None:
mitogen.master.upgrade_router(econtext)
mitogen.parent.upgrade_router(econtext)
context_id = router.allocate_id()
fakessh = mitogen.master.Context(router, context_id)
......
This diff is collapsed.
This diff is collapsed.
......@@ -33,7 +33,7 @@ import commands
import logging
import time
import mitogen.master
import mitogen.parent
LOG = logging.getLogger('mitogen')
......@@ -46,8 +46,8 @@ class PasswordError(mitogen.core.Error):
pass
class Stream(mitogen.master.Stream):
create_child = staticmethod(mitogen.master.tty_create_child)
class Stream(mitogen.parent.Stream):
create_child = staticmethod(mitogen.parent.tty_create_child)
python_path = 'python2.7'
#: The path to the SSH binary.
......@@ -103,8 +103,8 @@ class Stream(mitogen.master.Stream):
def _connect_bootstrap(self):
password_sent = False
for buf in mitogen.master.iter_read(self.receive_side.fd,
time.time() + 10.0):
for buf in mitogen.parent.iter_read(self.receive_side.fd,
time.time() + 10.0):
LOG.debug('%r: received %r', self, buf)
if buf.endswith('EC0\n'):
self._ec0_received()
......
......@@ -30,7 +30,7 @@ import os
import time
import mitogen.core
import mitogen.master
import mitogen.parent
LOG = logging.getLogger(__name__)
......@@ -41,8 +41,8 @@ class PasswordError(mitogen.core.Error):
pass
class Stream(mitogen.master.Stream):
create_child = staticmethod(mitogen.master.tty_create_child)
class Stream(mitogen.parent.Stream):
create_child = staticmethod(mitogen.parent.tty_create_child)
sudo_path = 'sudo'
password = None
......@@ -93,8 +93,8 @@ class Stream(mitogen.master.Stream):
def _connect_bootstrap(self):
password_sent = False
for buf in mitogen.master.iter_read(self.receive_side.fd,
time.time() + 10.0):
for buf in mitogen.parent.iter_read(self.receive_side.fd,
time.time() + 10.0):
LOG.debug('%r: received %r', self, buf)
if buf.endswith('EC0\n'):
self._ec0_received()
......
......@@ -8,6 +8,7 @@ import zlib
import mitogen.fakessh
import mitogen.master
import mitogen.parent
import mitogen.ssh
import mitogen.sudo
......@@ -26,9 +27,10 @@ print 'Preamble size: %s (%.2fKiB)' % (
for mod in (
mitogen.master,
mitogen.parent,
mitogen.ssh,
mitogen.sudo,
mitogen.fakessh,
):
sz = len(zlib.compress(mitogen.master.minimize_source(inspect.getsource(mod))))
sz = len(zlib.compress(mitogen.parent.minimize_source(inspect.getsource(mod))))
print '%s size: %s (%.2fKiB)' % (mod.__name__, sz, sz / 1024.0)
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