Example #1
0
def is_already_running(bus=None):
    """Return if the sd is running by trying to get the port."""
    ai = ActivationInstance(get_activation_config())
    try:
        yield ai.get_port()
        defer.returnValue(False)
    except AlreadyStartedError:
        defer.returnValue(True)
Example #2
0
def server_listen(server_factory, service_name, activation_cmdline, port,
                  reactor=None):
    """Connect the IPC server factory."""
    config = ActivationConfig(service_name, activation_cmdline, port)
    ai = ActivationInstance(config)
    port = yield ai.get_port()

    if reactor is None:
        from twisted.internet import reactor
    connector = reactor.listenTCP(port, server_factory, interface=LOCALHOST)
    defer.returnValue(connector)
Example #3
0
def server_listen(server_factory, service_name, activation_cmdline,
                  description, reactor=None):
    """Connect the IPC server factory."""
    config = ActivationConfig(service_name, activation_cmdline, description)
    ai = ActivationInstance(config)
    description = yield ai.get_server_description()

    if reactor is None:
        from twisted.internet import reactor
    server = endpoints.serverFromString(reactor, description)
    connector = yield server.listen(server_factory)
    defer.returnValue(connector)
Example #4
0
def server_listen(server_factory,
                  service_name,
                  activation_cmdline,
                  description,
                  reactor=None):
    """Connect the IPC server factory."""
    config = ActivationConfig(service_name, activation_cmdline, description)
    ai = ActivationInstance(config)
    description = yield ai.get_server_description()

    if reactor is None:
        from twisted.internet import reactor
    server = endpoints.serverFromString(reactor, description)
    connector = yield server.listen(server_factory)
    defer.returnValue(connector)