use epoll reactor for seed node script

This commit is contained in:
Jack Robison 2018-05-29 16:23:23 -04:00
parent 659632b66c
commit 30c4b160f1
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -5,6 +5,8 @@ import argparse
import hashlib import hashlib
from copy import deepcopy from copy import deepcopy
from urllib import urlopen from urllib import urlopen
from twisted.internet.epollreactor import install as install_epoll
install_epoll()
from twisted.internet import reactor, defer from twisted.internet import reactor, defer
from twisted.web import resource from twisted.web import resource
from twisted.web.server import Site from twisted.web.server import Site
@ -54,7 +56,7 @@ def format_contact(contact):
class MultiSeedRPCServer(AuthJSONRPCServer): class MultiSeedRPCServer(AuthJSONRPCServer):
def __init__(self, starting_node_port=4455, nodes=50, rpc_port=5280): def __init__(self, starting_node_port, nodes, rpc_port):
AuthJSONRPCServer.__init__(self, False) AuthJSONRPCServer.__init__(self, False)
self.port = None self.port = None
self.rpc_port = rpc_port self.rpc_port = rpc_port
@ -208,7 +210,7 @@ def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('--rpc_port', default=5280) parser.add_argument('--rpc_port', default=5280)
parser.add_argument('--starting_port', default=4455) parser.add_argument('--starting_port', default=4455)
parser.add_argument('--nodes', default=50) parser.add_argument('--nodes', default=32)
args = parser.parse_args() args = parser.parse_args()
MultiSeedRPCServer(int(args.starting_port), int(args.nodes), int(args.rpc_port)) MultiSeedRPCServer(int(args.starting_port), int(args.nodes), int(args.rpc_port))
reactor.run() reactor.run()