コード例 #1
0
def main():
    log = pyethereum.slogging.get_logger('app')
    log.info('starting', version=__version__)

    config = create_config()
    # configure logging
    config_string = config.get('misc', 'logging') or ':INFO'
    pyethereum.slogging.configure(config_string,
                                  log_json=bool(
                                      config.getint('misc', 'log_json')))
    log = pyethereum.slogging.get_logger('app')  # get updated logger
    # log config
    log.debug("config ready")
    for section in config.sections():
        for a, v in config.items(section):
            log.debug(section, **{a: v})

    config_ready.send(sender=None, config=config)

    # initialize chain
    check_chain_version(config)

    # P2P TCP SERVER
    try:
        tcp_server.start()
    except IOError as e:
        log.error("Could not start TCP server", error=e)
        sys.exit(1)

    # PEER MANAGER THREAD
    peer_manager.start()

    # CHAIN MANAGER THREAD
    chain_manager.start()

    # API SERVER THREAD
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        log.info('Signal handler called', signal=signum)
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(config.get('network', 'remote_host'),
                                  config.getint('network', 'remote_port'))

    # loop
    while not peer_manager.stopped():
        time.sleep(0.001)

    log.info('exiting')
    peer_manager.join()
    log.debug('main thread finished')
コード例 #2
0
ファイル: eth.py プロジェクト: ckeenan/pyethereum
def main():
    log = pyethereum.slogging.get_logger('app')
    log.info('starting', version=__version__)

    config = create_config()
    # configure logging
    config_string = config.get('misc', 'logging') or ':INFO'
    pyethereum.slogging.configure(config_string,
                                  log_json=bool(config.getint('misc', 'log_json')))
    log = pyethereum.slogging.get_logger('app')  # get updated logger
    # log config
    log.debug("config ready")
    for section in config.sections():
        for a, v in config.items(section):
            log.debug(section, **{a: v})

    config_ready.send(sender=None, config=config)

    # initialize chain
    check_chain_version(config)

    # P2P TCP SERVER
    try:
        tcp_server.start()
    except IOError as e:
        log.error("Could not start TCP server", error=e)
        sys.exit(1)

    # PEER MANAGER THREAD
    peer_manager.start()

    # CHAIN MANAGER THREAD
    chain_manager.start()

    # API SERVER THREAD
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        log.info('Signal handler called', signal=signum)
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(
            config.get('network', 'remote_host'),
            config.getint('network', 'remote_port'))

    # loop
    while not peer_manager.stopped():
        time.sleep(0.001)

    log.info('exiting')
    peer_manager.join()
    log.debug('main thread finished')
コード例 #3
0
ファイル: eth.py プロジェクト: miro-blakeley/pyethereum
def main():
    config = create_config()

    # configure logging
    configure_logging(config.get('misc', 'logging') or '',
                    verbosity=config.getint('misc', 'verbosity'))
    logger.info('----------- Starting pyethereum %s --------------', __version__)

    logger.debug("Config Ready:%s", konfig.dump_config(config))
    config_ready.send(sender=None, config=config)

    # initialize chain
    check_chain_version(config)
    from pyethereum.chainmanager import chain_manager

    # P2P TCP SERVER
    try:
        tcp_server.start()
    except IOError as e:
        logger.error("Could not start TCP server: \"{0}\"".format(str(e)))
        sys.exit(1)

    # PEER MANAGER THREAD
    peer_manager.start()

    # CHAIN MANAGER THREAD
    chain_manager.start()

    # API SERVER THREAD
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        logger.info('Signal handler called with signal {0}'.format(signum))
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(
            config.get('network', 'remote_host'),
            config.getint('network', 'remote_port'))

    # loop
    while not peer_manager.stopped():
        time.sleep(0.001)

    logger.info('exiting')
    peer_manager.join()
    logger.debug('main thread finished')
コード例 #4
0
def main():
    config = create_config()

    # configure logging
    configure_logging(config.get('misc', 'logging') or '',
                      verbosity=config.getint('misc', 'verbosity'))
    logger.info('----------- Starting pyethereum %s --------------',
                __version__)

    logger.debug("Config Ready:%s", konfig.dump_config(config))
    config_ready.send(sender=None, config=config)

    # initialize chain
    check_chain_version(config)
    from pyethereum.chainmanager import chain_manager

    # P2P TCP SERVER
    try:
        tcp_server.start()
    except IOError as e:
        logger.error("Could not start TCP server: \"{0}\"".format(str(e)))
        sys.exit(1)

    # PEER MANAGER THREAD
    peer_manager.start()

    # CHAIN MANAGER THREAD
    chain_manager.start()

    # API SERVER THREAD
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        logger.info('Signal handler called with signal {0}'.format(signum))
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(config.get('network', 'remote_host'),
                                  config.getint('network', 'remote_port'))

    # loop
    while not peer_manager.stopped():
        time.sleep(0.001)

    logger.info('exiting')
    peer_manager.join()
    logger.debug('main thread finished')
コード例 #5
0
ファイル: eth.py プロジェクト: zancas/pyethereum
def main():
    config = create_config()
    config_ready.send(sender=config)

    try:
        tcp_server.start()
    except IOError as e:
        logger.error("Could not start TCP server: \"{0}\"".format(str(e)))
        sys.exit(1)

    peer_manager.start()
    chain_manager.start()
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        logger.info('Signal handler called with signal {0}'.format(signum))
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(
            config.get('network', 'remote_host'),
            config.getint('network', 'remote_port'))

    # loop
    while not peer_manager.stopped():
        time.sleep(0.1)
        if len(peer_manager.get_connected_peer_addresses()) > 2:
            chain_manager.bootstrap_blockchain()

    logger.info('exiting')

    peer_manager.join()

    logger.debug('main thread finished')
コード例 #6
0
ファイル: eth.py プロジェクト: FrequentEscape/pyethereum
        logger.info("Loaded your customizations from monkeypatch.py")
    except ImportError, e:
        pass

    config_ready.send(sender=None, config=config)
    # import after logger config is ready
    from pyethereum.chainmanager import chain_manager

    try:
        tcp_server.start()
    except IOError as e:
        logger.error("Could not start TCP server: \"{0}\"".format(str(e)))
        sys.exit(1)

    peer_manager.start()
    chain_manager.start()
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        logger.info('Signal handler called with signal {0}'.format(signum))
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(
コード例 #7
0
        logger.info("Loaded your customizations from monkeypatch.py")
    except ImportError, e:
        pass

    config_ready.send(sender=None, config=config)
    # import after logger config is ready
    from pyethereum.chainmanager import chain_manager

    try:
        tcp_server.start()
    except IOError as e:
        logger.error("Could not start TCP server: \"{0}\"".format(str(e)))
        sys.exit(1)

    peer_manager.start()
    chain_manager.start()
    api_server.start()

    # handle termination signals
    def signal_handler(signum=None, frame=None):
        logger.info('Signal handler called with signal {0}'.format(signum))
        peer_manager.stop()
        chain_manager.stop()
        tcp_server.stop()

    for sig in [signal.SIGTERM, signal.SIGHUP, signal.SIGQUIT, signal.SIGINT]:
        signal.signal(sig, signal_handler)

    # connect peer
    if config.get('network', 'remote_host'):
        peer_manager.connect_peer(config.get('network', 'remote_host'),