Beispiel #1
0
    def handle_exception(self, typ, error, tb):
        if self._finalized:
            return True

        if self._sent:
            self.force_finish()
            return True

        if isinstance(error, _RequestTimeout):
            if self._stream_ended:
                self.finish()
                return True
            else:
                error = HTTPError(599, "Timeout")

        self._remove_timeout()
        self._unregister_unfinished_streams()
        if hasattr(self, 'stream_id'):
            self.context.remove_stream_delegate(self.stream_id)
            self.context.reset_stream(self.stream_id, flush=True)

        error.__traceback__ = tb
        response = HTTP2Response(
            self.request, 599, error=error,
            request_time=self.io_loop.time() - self.start_time,
        )
        self._run_callback(response)
        return True
Beispiel #2
0
    def handle_exception(self, typ, error, tb):
        if isinstance(error, _RequestTimeout):
            if self._stream_ended:
                self.finish()
                return True
            else:
                error = HTTPError(599, "Timeout")

        self._remove_timeout()
        self._unregister_unfinished_streams()
        if hasattr(self, 'stream_id'):
            self.context.remove_stream_delegate(self.stream_id)

            # FIXME: our nginx server will simply reset stream,
            # without increase the window size which consumed by
            # queued data frame which was belongs to the stream we're resetting
            # self.context.reset_stream(self.stream_id, flush=True)
            self.context.reset_stream_ids.append(self.stream_id)

        error.__traceback__ = tb
        response = HTTP2Response(
            self.request,
            599,
            error=error,
            request_time=self.io_loop.time() - self.start_time,
        )
        self._run_callback(response)
        return True
Beispiel #3
0
    def handle_exception(self, typ, error, tb):
        if isinstance(error, _RequestTimeout):
            if self._stream_ended:
                self.finish()
                return True
            else:
                error = HTTPError(599, "Timeout")

        self._remove_timeout()
        self._unregister_unfinished_streams()
        if hasattr(self, "stream_id"):
            self.context.remove_stream_delegate(self.stream_id)

            # FIXME: our nginx server will simply reset stream,
            # without increase the window size which consumed by
            # queued data frame which was belongs to the stream we're resetting
            # self.context.reset_stream(self.stream_id, flush=True)
            self.context.reset_stream_ids.append(self.stream_id)

        error.__traceback__ = tb
        response = HTTP2Response(self.request, 599, error=error, request_time=self.io_loop.time() - self.start_time)
        self._run_callback(response)
        return True