def insertWebsite(self, url, domain):
		'''增加一个网页,标记为未访问,并对相应的domain增加其入度'''
		cur = self.conn.cursor()
		cur.execute("SELECT 1 FROM Domains WHERE domain=?", (domain,))
		result = cur.fetchone()
		if not result:
			# 未有对应domain记录, 先创建domain, 把入度设为1
			if VERBOSE:
				print 'Spot Domain:',domain
			self.insertDomain(domain, indegree=1)
			cur.execute("SELECT did FROM Domains WHERE domain=?", (domain,))
			did = cur.fetchone()[0]
		else:
			did = result[0]
			# 对应的domain记录已经存在, 对其入度+1
			cur.execute("UPDATE Domains SET outdegree=outdegree+1 WHERE domain=?", (domain,))

		cur.execute("INSERT INTO Websites VALUES (NULL,?,?,NULL,0)", (did, url,))
		# 写入到文件
		self.conn.commit()
def execute_rpc(self, audit_name, rpc_code, response_queue, args, kwargs):
        """
        Honor a remote procedure call request from a plugin.

        :param audit_name: Name of the audit requesting the call.
        :type audit_name: str

        :param rpc_code: RPC code.
        :type rpc_code: int

        :param response_queue: Response queue identity.
        :type response_queue: str

        :param args: Positional arguments to the call.
        :type args: tuple

        :param kwargs: Keyword arguments to the call.
        :type kwargs: dict
        """
        try:

            # Get the implementor for the RPC code.
            # Raise NotImplementedError if it's not defined.
            try:
                target, blocking = self.__rpcMap[rpc_code]
            except KeyError:
                raise NotImplementedError(
                    "RPC code not implemented: %r" % rpc_code)

            # If it's a blocking call...
            if blocking:

                # Run the implementor in a new thread.
                thread = Thread(
                    target = self._execute_rpc_implementor_background,
                    args = (
                        Config._context,
                        audit_name,
                        target,
                        response_queue,
                        args, kwargs),
                )
                thread.daemon = True
                thread.start()

            # If it's a non-blocking call...
            else:

                # Call the implementor directly.
                self.execute_rpc_implementor(
                    audit_name, target, response_queue, args, kwargs)

        # Catch exceptions and send them back.
        except Exception:
            if response_queue:
                error = self.prepare_exception(*sys.exc_info())
                try:
                    self.orchestrator.messageManager.send(
                        response_queue, (False, error))
                except IOError:
                    import warnings
                    warnings.warn("RPC caller died!")
                    pass