Esempio n. 1
0
	def Run(self):
		"""Main loop.

		This method is the main loop for a RADIUS server. It waits
		for packets to arrive via the network and calls other methods
		to process them.
		"""
		self._poll=select.poll()
		self._fdmap={}
		self._PrepareSockets()

		while not main.isShuttingDown():
			for (fd, event) in self._poll.poll():
				if main.isShuttingDown():
				    return
				fdo=self._fdmap[fd]
				if event==select.POLLIN:
					try:
						fdo=self._fdmap[fd]
						self._ProcessInput(fdo)
					except PacketError, err:
						logException(LOG_ERROR,"Radius Server: Dropping packet: %s" % str(err))
					except packet.PacketError, err:
						logException(LOG_ERROR,"Radius Server: Received a broken packet: %s" % str(err))
					except:
					    logException(LOG_ERROR)
Esempio n. 2
0
    def Run(self):
        """Main loop.

                This method is the main loop for a RADIUS server. It waits
                for packets to arrive via the network and calls other methods
                to process them.
                """
        self._poll = select.poll()
        self._fdmap = {}
        self._PrepareSockets()

        while not main.isShuttingDown():
            try:
                for (fd, event) in self._poll.poll():
                    if main.isShuttingDown():
                        return

                    fdo = self._fdmap[fd]
                    if event == select.POLLIN:
                        try:
                            fdo = self._fdmap[fd]
                            self._ProcessInput(fdo)
                        except PacketError, err:
                            logException(
                                LOG_ERROR,
                                "Radius Server: Dropping packet: %s" %
                                str(err))
                        except packet.PacketError, err:
                            logException(
                                LOG_ERROR,
                                "Radius Server: Received a broken packet: %s" %
                                str(err))
                        except:
Esempio n. 3
0
    def runThread(self,wrapper,method,args_list=[]):
	"""
	    run a thread, that is called from wrapper "wrapper" to run method "method"
	    with arguments "args_list"
	    wrapper(ThreadPoolWrapper instance): wrapper that want to allocate new thread
	    method(function): function to run
	    arg_list(list): list of arguments
	"""
        if not main.isShuttingDown():
            self.__runThread(wrapper,method,args_list)
        else:
            raise ThreadException("We're shutting down")
Esempio n. 4
0
 def runThread(self, wrapper, method, args_list=[]):
     """
         run a thread, that is called from wrapper "wrapper" to run method "method"
         with arguments "args_list"
         
         wrapper(ThreadPoolWrapper instance): wrapper that want to allocate new thread
         method(function): function to run
         arg_list(list): list of arguments
     """
     if not main.isShuttingDown():
         self.__runThread(wrapper, method, args_list)
     else:
         raise ThreadException("We're shutting down")
Esempio n. 5
0
 def __initializeHandles(self):
     retry = 3
     for i in range(defs.DB_POOL_DEFAULT_CONNECTIONS):
         while not main.isShuttingDown():
             try:
                 self.__addNewHandleToPool()
             except DBException:
                 if retry == 0:
                     raise
                 elif i == 0:
                     retry -= 1
                     time.sleep(5)
                     continue
             break
Esempio n. 6
0
    def __initializeHandles(self):
	retry=3
	for i in range(defs.DB_POOL_DEFAULT_CONNECTIONS):
	    while not main.isShuttingDown():
		try:
		    self.__addNewHandleToPool()
		except DBException:
		    if retry==0:
			raise
		    elif i==0:
			retry-=1
			time.sleep(5)
			continue
		break		
Esempio n. 7
0
 def serve_forever(self):
     while not main.isShuttingDown():
         self.handle_request()
Esempio n. 8
0
 def process_request(self, request, client_address):
     if not main.isShuttingDown() and not main.noLoginSet():
         thread_main.runThread(self.process_request_thread,
                               [request, client_address], "server")
Esempio n. 9
0
 def serve_forever(self):
     while not main.isShuttingDown():
         self.handle_request()
Esempio n. 10
0
 def process_request(self, request, client_address):
     if not main.isShuttingDown() and not main.noLoginSet():
         thread_main.runThread(self.process_request_thread, [request, client_address], "server")