Пример #1
0
	def xmlrpc_run(self, port=13100, bind='127.0.0.1', logRequests=False):
		'''Run xmlrpc server'''
		import umsgpack
		try:
			from xmlrpc.server import SimpleXMLRPCServer
			from xmlrpc.client import Binary
		except ImportError:
			from SimpleXMLRPCServer import SimpleXMLRPCServer
			from xmlrpclib import Binary

		logger.info("bloomfilter starting...")

		server = SimpleXMLRPCServer((bind, port), allow_none=True, logRequests=logRequests)
		server.register_introspection_functions()
		server.register_multicall_functions()

		server.register_function(self.quit, '_quit')

		server.register_function(self.add, 'add')

		server.timeout = 0.5
		while not self._quit:
			server.handle_request()

		logger.info("bloomfilter exiting...")
		server.server_close()