(self, fd)
Serves requests from the given connection and puts it back to the appropriate queue
Serves requests from the given connection and puts it back to the appropriate queue
Serves requests from the given connection and puts it back to the appropriate queue
def _serve_requests(self, fd):
        '''Serves requests from the given connection and puts it back to the appropriate queue'''
        # serve a maximum of RequestBatchSize requests for this connection
        for _ in range(self.request_batch_size):
            try:
                if not self.fd_to_conn[fd].poll(): # note that poll serves the request
                    # we could not find a request, so we put this connection back to the inactive set
                    self._add_inactive_connection(fd)
                    return
            except EOFError:
                # the connection has been closed by the remote end. Close it on our side and return
                self._drop_connection(fd)
                return
            except Exception:
                # put back the connection to active queue in doubt and raise the exception to the upper level
                self._active_connection_queue.put(fd)
                raise
        # we've processed the maximum number of requests. Put back the connection in the active queue
        self._active_connection_queue.put(fd)
def _serve_requests ( self , fd ) : # serve a maximum of RequestBatchSize requests for this connection for _ in range ( self . request_batch_size ) : try : if not self . fd_to_conn [ fd ] . poll ( ) : # note that poll serves the request # we could not find a request, so we put this connection back to the inactive set self . _add_inactive_connection ( fd ) return except EOFError : # the connection has been closed by the remote end. Close it on our side and return self . _drop_connection ( fd ) return except Exception : # put back the connection to active queue in doubt and raise the exception to the upper level self . _active_connection_queue . put ( fd ) raise # we've processed the maximum number of requests. Put back the connection in the active queue self . _active_connection_queue . put ( fd )