예제 #1
0
    def handle_transaction(self, stream_id, transaction):
        try:
            isValid, response = self.message_verifier.verify_message(
                transaction)
            entry = cache.make_payload(transaction, binary=self.binary)
            entry['stream_id'] = " ".join(
                [format(ord(x), "02x") for x in stream_id])
            path = cache.cache(entry)
            if isValid:
                self.counter.read()
                self.counter.update()
            else:
                storage_archive.archive(path, name="invalid")
                self.counter.invalid()
                self.counter.update()

            dest_addr = self.short_address[stream_id]
            self.radio.send("tx",
                            dest_addr_long=stream_id,
                            dest_addr=dest_addr,
                            data=response)

        except Exception, e:
            self.logger.exception(
                "Error handling transaction from: %s %%s" % stream_id, e)
예제 #2
0
 def handle_frame(self, response):
     if response is None:
         self.logger.error("There was an error reading")
     else:
         if self.packet_filter(response):
             cache.cache(cache.make_payload(response, binary=True))
             self.counter.read()
             self.counter.update()
         else:
             self.logger.info("Packet dropped by packet filter.")
예제 #3
0
 def handle_frame(self, response):
     if response is None:
         self.logger.error("There was an error reading")
     else:
         if self.packet_filter(response):
             cache.cache(cache.make_payload(response, binary=True))
             self.counter.read()
             self.counter.update()
         else:
             self.logger.info("Packet dropped by packet filter.")
예제 #4
0
    def handle_transaction(self, stream_id, transaction):
        try:
            isValid, response = self.message_verifier.verify_message(transaction)
            entry = cache.make_payload(transaction, binary=self.binary)
            entry['stream_id'] = stream_id
            path = cache.cache(entry)

            if isValid:
                self.counter.read()
                self.counter.update()
            else:
                storage_archive.archive(path, name="invalid")
                self.counter.invalid()
                self.counter.update()

        except Exception, e:
            self.logger.exception("Error handling transaction from: %s %%s" % stream_id, e)
예제 #5
0
    def handle_transaction(self, stream_id, transaction):
        try:
            isValid, response = self.message_verifier.verify_message(transaction)
            entry = cache.make_payload(transaction, binary=self.binary)
            entry['stream_id'] = " ".join([format(ord(x), "02x") for x in stream_id])
            path = cache.cache(entry)
            if isValid:
                self.counter.read()
                self.counter.update()
            else:
                storage_archive.archive(path, name="invalid")
                self.counter.invalid()
                self.counter.update()

            dest_addr = self.short_address[stream_id]
            self.radio.send("tx", dest_addr_long=stream_id, dest_addr=dest_addr, data=response)


        except Exception, e:
            self.logger.exception("Error handling transaction from: %s %%s" % stream_id, e)
예제 #6
0
 def handle_transaction(self, stream_id, transaction):
     try:
         entry = cache.make_payload(transaction, binary=self.binary)
         entry['stream_id'] = " ".join(
             [format(ord(x), "02x") for x in stream_id])
         cache.cache(entry)
         self.counter.read()
         self.counter.update()
         if self.ack:
             dest_addr = self.short_address[stream_id]
             if hasattr(self.ack, '__call__'):
                 self.radio.send("tx",
                                 dest_addr_long=stream_id,
                                 dest_addr=dest_addr,
                                 data=self.ack())
             else:
                 self.radio.send("tx",
                                 dest_addr_long=stream_id,
                                 dest_addr=dest_addr,
                                 data=self.ack)
     except Exception, e:
         self.logger.exception(
             "Error handling transaction from: %s %%s" % stream_id, e)