Ejemplo n.º 1
0
    # mount the block database
    the_block_db = block_db()

    if '-w' in sys.argv:
        i = sys.argv.index ('-w')
        the_wallet = wallet (sys.argv[i+1])
        del sys.argv[i:i+2]

    # client mode
    if '-c' in sys.argv:
        i = sys.argv.index ('-c')
        if len(sys.argv) < 3:
            print 'usage: %s -c <externally-visible-ip-address> <server-ip-address>' % (sys.argv[0],)
        else:
            [my_addr, other_addr] = sys.argv[i+1:i+3]
            valid_ip (my_addr)
            import monitor
            # for now, there's a single global connection.  later we'll have a bunch.
            bc = connection (other_addr)
            m = monitor.monitor_server()
            h = asynhttp.http_server ('127.0.0.1', 8380)
            import webadmin
            h.install_handler (webadmin.handler())
            try:
                asyncore.loop(timeout = 5)
            except:
                print("received interrupt signal, stopping")
    else:
        # database browsing mode
        db = the_block_db # alias
Ejemplo n.º 2
0
        addrs = dns_seed()
        for addr in addrs:
            connection (addr)
        network = True

    do_monitor = '-m' in sys.argv
    do_admin   = '-a' in sys.argv

    if network:
        if do_monitor:
            import coro.backdoor
            coro.spawn (coro.backdoor.serve, unix_path='/tmp/caesure.bd')
        if do_admin:
            import coro.http
            import webadmin
            import zlib
            h = coro.http.server()
            coro.spawn (h.start, (('127.0.0.1', 8380)))
            h.push_handler (webadmin.handler())
            h.push_handler (coro.http.handlers.coro_status_handler())
            h.push_handler (coro.http.handlers.favicon_handler (zlib.compress (webadmin.favicon)))
        coro.event_loop()
    else:
        # database browsing mode
        db = the_block_db # alias
        
    # this is just so I can use the coro profiler
    #import coro.profiler
    #coro.spawn (build_txmap)
    #coro.event_loop()
Ejemplo n.º 3
0
            connection(addr)
        network = True

    do_monitor = '-m' in sys.argv
    do_admin = '-a' in sys.argv

    if network:
        if do_monitor:
            import coro.backdoor
            coro.spawn(coro.backdoor.serve, unix_path='/tmp/caesure.bd')
        if do_admin:
            import coro.http
            import webadmin
            import zlib
            h = coro.http.server()
            coro.spawn(h.start, (('127.0.0.1', 8380)))
            h.push_handler(webadmin.handler())
            h.push_handler(coro.http.handlers.coro_status_handler())
            h.push_handler(
                coro.http.handlers.favicon_handler(
                    zlib.compress(webadmin.favicon)))
        coro.event_loop()
    else:
        # database browsing mode
        db = the_block_db  # alias

    # this is just so I can use the coro profiler
    #import coro.profiler
    #coro.spawn (build_txmap)
    #coro.event_loop()