예제 #1
0
파일: ipc.py 프로젝트: thnguyn2/ECE_527_MP
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)
예제 #2
0
파일: ipc.py 프로젝트: thnguyn2/ECE_527_MP
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)
예제 #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)
예제 #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)