How to use the fbtftp.constants.ERR_UNDEFINED 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
self._last_block_sent = 0  # Wrap around the block counter.
        try:
            last_size = 0  # current_block size before read. Used to check EOF.
            self._current_block = self._response_data.read(self._block_size)
            while (
                len(self._current_block) != self._block_size
                and len(self._current_block) != last_size
            ):
                last_size = len(self._current_block)
                self._current_block += self._response_data.read(
                    self._block_size - last_size
                )
        except Exception as e:
            logging.exception("Error while reading from source: %s" % e)
            self._stats.error = {
                "error_code": constants.ERR_UNDEFINED,
                "error_message": "Error while reading from source",
            }
            self._transmit_error()
            self._should_stop = True