Beispiel #1
0
func (conn *http2Connection) getStream(frame http2.Frame) (*HTTP2Stream, bool) {
	conn.lock.Lock()
	defer conn.lock.Unlock()
	if conn.streams == nil {
		// Connection is closing.
		return nil, false
	}
	stream, ok := conn.streams[frame.Header().StreamID]
	return stream, ok
}
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
}
Beispiel #3
0
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
}
Beispiel #4
0
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
}
Beispiel #5
0
func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) {
	t.mu.Lock()
	defer t.mu.Unlock()
	s, ok := t.activeStreams[f.Header().StreamID]
	return s, ok
}