Ejemplo n.º 1
0
def runDconfigPusher():
    import dtella.bridge_config as cfg
    setLogFile(cfg.file_base + ".log", 4<<20, 4)
    LOG.debug("Dconfig Pusher Logging Manager Initialized")

    addTwistedErrorCatcher(LOG.critical)

    from dtella.bridge.push_dconfig_main import DtellaMain_DconfigPusher
    dtMain = DtellaMain_DconfigPusher()
    reactor.run()
Ejemplo n.º 2
0
def runDconfigPusher():
    import dtella.bridge_config as cfg
    setLogFile(cfg.file_base + ".log", 4 << 20, 4)
    LOG.debug("Dconfig Pusher Logging Manager Initialized")

    addTwistedErrorCatcher(LOG.critical)

    from dtella.bridge.push_dconfig_main import DtellaMain_DconfigPusher
    dtMain = DtellaMain_DconfigPusher()
    reactor.run()
Ejemplo n.º 3
0
def runClient(dc_port):
    #Logging for Dtella Client
    setLogFile("dtella.log", 1<<20, 1)
    LOG.debug("Client Logging Manager Initialized")

    from dtella.client.main import DtellaMain_Client
    dtMain = DtellaMain_Client()

    import dtella.local_config as local
    from dtella.common.util import get_version_string

    def botErrorReporter(text):
        dch = dtMain.dch
        if dch:
            dch.bot.say(
                "Something bad happened.  You might want to email this to "
                "[email protected] so we'll know about it:\n"
                "Version: %s %s\n%s" %
                (local.hub_name, get_version_string()[3:], text))

    addTwistedErrorCatcher(botErrorReporter)
    addTwistedErrorCatcher(LOG.critical)

    from dtella.client.dc import DCFactory
    dfactory = DCFactory(dtMain, dc_port)

    LOG.info("%s %s" % (local.hub_name, local.version))

    def cb(first):
        try:
            reactor.listenTCP(dc_port, dfactory, interface='127.0.0.1')
        except twisted.internet.error.CannotListenError:
            if first:
                LOG.warning("TCP bind failed.  Killing old process...")
                if terminate(dc_port):
                    LOG.info("Ok.  Sleeping...")
                    reactor.callLater(2.0, cb, False)
                else:
                    LOG.error("Kill failed.  Giving up.")
                    reactor.stop()
            else:
                LOG.error("Bind failed again.  Giving up.")
                reactor.stop()
        else:
            LOG.info("Listening on 127.0.0.1:%d" % dc_port)
            dtMain.startConnecting()

    reactor.callWhenRunning(cb, True)
    reactor.run()
Ejemplo n.º 4
0
def runClient(dc_port):
    #Logging for Dtella Client
    setLogFile("dtella.log", 1 << 20, 1)
    LOG.debug("Client Logging Manager Initialized")

    from dtella.client.main import DtellaMain_Client
    dtMain = DtellaMain_Client()

    import dtella.local_config as local
    from dtella.common.util import get_version_string

    def botErrorReporter(text):
        dch = dtMain.dch
        if dch:
            dch.bot.say(
                "Something bad happened.  You might want to email this to "
                "[email protected] so we'll know about it:\n"
                "Version: %s %s\n%s" %
                (local.hub_name, get_version_string()[3:], text))

    addTwistedErrorCatcher(botErrorReporter)
    addTwistedErrorCatcher(LOG.critical)

    from dtella.client.dc import DCFactory
    dfactory = DCFactory(dtMain, dc_port)

    LOG.info("%s %s" % (local.hub_name, local.version))

    def cb(first):
        try:
            reactor.listenTCP(dc_port, dfactory, interface='127.0.0.1')
        except twisted.internet.error.CannotListenError:
            if first:
                LOG.warning("TCP bind failed.  Killing old process...")
                if terminate(dc_port):
                    LOG.info("Ok.  Sleeping...")
                    reactor.callLater(2.0, cb, False)
                else:
                    LOG.error("Kill failed.  Giving up.")
                    reactor.stop()
            else:
                LOG.error("Bind failed again.  Giving up.")
                reactor.stop()
        else:
            LOG.info("Listening on 127.0.0.1:%d" % dc_port)
            dtMain.startConnecting()

    reactor.callWhenRunning(cb, True)
    reactor.run()
Ejemplo n.º 5
0
def runBridge():
    import dtella.bridge_config as cfg
    setLogFile(cfg.file_base + ".log", 4<<20, 4)
    LOG.debug("Bridge Logging Manager Initialized")

    addTwistedErrorCatcher(LOG.critical)

    from dtella.bridge.main import DtellaMain_Bridge
    dtMain = DtellaMain_Bridge()

    from dtella.bridge.bridge_server import getServiceConfig
    scfg = getServiceConfig()
    scfg.startService(dtMain)

    reactor.run()
Ejemplo n.º 6
0
def runBridge():
    import dtella.bridge_config as cfg
    setLogFile(cfg.file_base + ".log", 4 << 20, 4)
    LOG.debug("Bridge Logging Manager Initialized")

    addTwistedErrorCatcher(LOG.critical)

    from dtella.bridge.main import DtellaMain_Bridge
    dtMain = DtellaMain_Bridge()

    from dtella.bridge.bridge_server import getServiceConfig
    scfg = getServiceConfig()
    scfg.startService(dtMain)

    reactor.run()