def fail_logical_channel(self, channel_id, code, message):
        """Fail a logical channel.

        Args:
            channel_id: channel id.
            code: drop reason code.
            message: drop message.
        """

        self._logger.debug('Failing logical channel %d...' % channel_id)
        try:
            self._logical_channels_condition.acquire()
            if channel_id in self._logical_channels:
                channel_data = self._logical_channels[channel_id]
                # Close the logical channel. notify_worker_done() will be
                # called later and it will send DropChannel.
                channel_data.drop_code = code
                channel_data.drop_message = message

                channel_data.request.connection.set_read_state(
                    _LogicalConnection.STATE_TERMINATED)
                channel_data.request.ws_stream.stop_sending()
            else:
                self._send_drop_channel(channel_id, code, message)
        finally:
            self._logical_channels_condition.release()
dataset/ETHPy150Open google/pywebsocket/mod_pywebsocket/mux.py/_MuxHandler.fail_logical_channel/original