Esempio n. 1
0
 def handle_transaction(self, stream_id, emit):
     entry = make_payload(emit)
     entry['stream_id'] = stream_id
     storage_cache.cache(entry)
     self.logger.info("End of Transaction")
     self.counter.read()
     self.counter.update()
Esempio n. 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.")
Esempio n. 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.")
Esempio n. 4
0
    def e_trans_impl(state, config, data):
        try:
            if "match_all" in state: del _state[state.match_all]
            if "data" in state:
                state.data.append(data)
                storage_cache.cache(make_payload(format_data(state.data)))
                del state["data"]
                logger.info("End of Transaction")
                config.counter.read()
                config.counter.update()
        except Exception, e:
            import traceback

            traceback.print_exc()
            config.counter.error()
Esempio n. 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)
Esempio n. 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)
Esempio n. 7
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)
Esempio n. 8
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)