How to use the fbtftp.constants.ERR_ILLEGAL_OPERATION function in fbtftp

To help you get started, we’ve selected a few fbtftp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github facebook / fbtftp / fbtftp / base_handler.py View on Github external
"error_code": block_number,
                "error_message": data[4:-1].decode("ascii", "ignore"),
            }
            # An error was reported by the client which terminates the exchange
            logging.error(
                "Error reported from client: %s" % self._stats.error["error_message"]
            )
            self._transmit_error()
            self._should_stop = True
            return
        if code != constants.OPCODE_ACK:
            logging.error(
                "Expected an ACK opcode from %s, got: %d" % (self._peer, code)
            )
            self._stats.error = {
                "error_code": constants.ERR_ILLEGAL_OPERATION,
                "error_message": "I only do reads, really",
            }
            self._transmit_error()
            self._should_stop = True
            return
        self._handle_ack(block_number)