def msg_helo(self, conn, msg):
        if self.debug: self.logger.write("State", "Received HELO")
        # This is the first other replica, it should be added by this replica
        if len(self.replicas) == 0:
            if self.debug: self.logger.write("State", "Adding the first REPLICA")
            # Agree on adding self and the first replica:
            self.become_leader()
            # Add self
            self.replicas[self.me] = 0
            addcommand = self.create_add_command(self.me)
            self.pick_commandnumber_add_to_pending(addcommand)
            for i in range(WINDOW+3):
                noopcommand = self.create_noop_command()
                self.pick_commandnumber_add_to_pending(noopcommand)
            self.issue_pending_commands()
            # Add replica
            addcommand = self.create_add_command(msg.source)
            self.pick_commandnumber_add_to_pending(addcommand)
            for i in range(WINDOW+3):
                noopcommand = self.create_noop_command()
                self.pick_commandnumber_add_to_pending(noopcommand)
            self.issue_pending_commands()
        else:
            if self.isleader:
                if self.debug: self.logger.write("State", "Adding the new node")
                addcommand = self.create_add_command(msg.source)
                self.pick_commandnumber_add_to_pending(addcommand)
                for i in range(WINDOW+3):
                    noopcommand = self.create_noop_command()
                    self.pick_commandnumber_add_to_pending(noopcommand)
                self.issue_pending_commands()
            else:
                if self.debug: self.logger.write("State", "Not the leader, sending a HELOREPLY")
                if self.debug: self.logger.write("State", str(self.find_leader()) % "Leader is %s")
                heloreplymessage = create_message(MSG_HELOREPLY, self.me,
                                                  {FLD_LEADER: self.find_leader()})
                conn.send(heloreplymessage)
dataset/ETHPy150Open denizalti/concoord/concoord/replica.py/Replica.msg_helo/swapped operands of `%`