func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { t.mu.Lock() defer t.mu.Unlock() if t.activeStreams == nil { // The transport is closing. return nil, false } if s, ok := t.activeStreams[f.Header().StreamID]; ok { return s, true } return nil, false }
func (t *http2Server) getStream(f http2.Frame) (*Stream, bool) { t.mu.Lock() defer t.mu.Unlock() if t.activeStreams == nil { // The transport is closing. return nil, false } s, ok := t.activeStreams[f.Header().StreamID] if !ok { // The stream is already done. return nil, false } return s, true }
func CreateResultFrame(f http2.Frame) (rf *ResultFrame) { rf = &ResultFrame{ Type: f.Header().Type, Flags: f.Header().Flags, Length: f.Header().Length, } switch f := f.(type) { case *http2.GoAwayFrame: rf.ErrCode = f.ErrCode case *http2.RSTStreamFrame: rf.ErrCode = f.ErrCode default: rf.ErrCode = ErrCodeDefault } return rf }