def __init__(self,
                 addr=args.addr,
                 port=args.port,
                 givenbootstraplist=args.bootstrap,
                 debugoption=args.debug,
                 objectname=args.objectname,
                 logger=args.logger,
                 writetodisk=args.writetodisk):
        self.addr = addr if addr else findOwnIP()
        self.port = port
        self.debug = debugoption
        self.durable = writetodisk
        self.isnameserver = args.domain != ''
        self.domain = args.domain
        self.useroute53 = args.route53
        if objectname == '':
            parser.print_help()
            self._graceexit(1)
        self.objectname = objectname
        # initialize receive queue
        self.receivedmessages_semaphore = Semaphore(0)
        self.receivedmessages = []
        # lock to synchronize message handling
        self.lock = Lock()

        # create server socket and bind to a port
        self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
        self.socket.setblocking(0)
        if self.port:
            try:
                self.socket.bind((self.addr,self.port))
            except socket.error as e:
                print "Cannot bind to port %d" % self.port
                print "Socket Error: ", e
                self._graceexit(1)
        else:
            for i in range(50):
                self.port = random.randint(14000,15000)
                try:
                    self.socket.bind((self.addr,self.port))
                    break
                except socket.error as e:
                    print "Socket Error: ", e
        self.socket.listen(10)
        self.connectionpool = ConnectionPool()

        try:
            self.connectionpool.epoll = select.epoll()
        except AttributeError as e:
            # the os doesn't support epoll
            self.connectionpool.epoll = None

        # set the logger
        if logger:
            LOGGERNODE = logger
        else:
            LOGGERNODE = None

        # Initialize replicas
        # Keeps {peer:outofreachcount}
        self.replicas = {}
        # Nameserver state
        if self.isnameserver:
            self.type = NODE_NAMESERVER
            try:
                self.nameserver = Nameserver(self.addr, self.domain, self.useroute53,
                                             self.replicas, self.debug)
            except Exception as e:
                print "Error:", e
                print "Could not start Replica as a Nameserver, exiting."
                self._graceexit(1)
        else:
            self.type = NODE_REPLICA

        self.alive = True
        self.me = Peer(self.addr,self.port,self.type)
        # set id
        self.id = '%s:%d' % (self.addr, self.port)
        # add self to connectionpool
        self.connectionpool.add_connection_to_self(self.me,
                                                   SelfConnection(self.receivedmessages,
                                                                  self.receivedmessages_semaphore))
        self.logger = Logger("%s-%s" % (node_names[self.type],self.id), lognode=LOGGERNODE)
        if self.isnameserver:
            self.nameserver.add_logger(self.logger)
        print (node_names[self.type],self.id) % "%s-%s connected."

        # Keeps the liveness of the nodes
        self.nodeliveness = {}
        self.bootstrapset = set()
        # connect to the bootstrap node
        if givenbootstraplist:
            self.discoverbootstrap(givenbootstraplist)
            self.connecttobootstrap()

        self.stateuptodate = False
dataset/ETHPy150Open denizalti/concoord/concoord/node.py/Node.__init__/swapped operands of `%`