

def _receive_frame(self, frame):
    '\n        Handle a frame received on the connection.\n\n        .. versionchanged:: 2.0.0\n           Removed from the public API.\n        '
    try:
        (frames, events) = self._frame_dispatch_table[frame.__class__](frame)
    except StreamClosedError as e:
        if (frame.stream_id not in self._reset_streams):
            f = RstStreamFrame(e.stream_id)
            f.error_code = e.error_code
            self._prepare_for_sending([f])
            events = e._events
        else:
            events = []
    except StreamIDTooLowError as e:
        if (frame.stream_id not in self._reset_streams):
            raise
        events = []
    except KeyError as e:
        raise UnsupportedFrameError(('Unexpected frame: %s' % frame))
    else:
        self._prepare_for_sending(frames)
    return events

dataset/ETHPy150Open python-hyper/hyper-h2/h2/connection.py H2Connection._receive_frame/original