コード例 #1
0
class DRRequestHandler(BaseRequestHandler):

    def __init__(self, request, client_address, server, data_store_handler):
        self.data_store_handler = data_store_handler
        self.model_int = Interface()
        BaseRequestHandler.__init__(self, request, client_address, server)


    def handle(self):
        #logger.debug("recieved 1 msg from %s:%d" % \
        #             (self.client_address[0], self.client_address[1]))
        data = self.request[0]
        ip = self.client_address[0]
        try:
            #logger.debug(list(self.model_int.session.root.get("active", {}).keys()))
            host_obj = self.model_int.getActiveHost(ip)
            host_id = host_obj.id
            host_obj.last_arrival = time.time()
            self.model_int.close()
            self.data_store_handler.onDataArrival(host_id, decode(data))
        except KeyError, e:
            # TODO 
            #logger.debug('recieved msg from unsigned host %s' % \
                         #(self.client_address,))
            return
コード例 #2
0
 def __init__(self, request, client_address, server, data_store_handler):
     self.data_store_handler = data_store_handler
     self.model_int = Interface()
     BaseRequestHandler.__init__(self, request, client_address, server)