예제 #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
}
예제 #2
0
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
}
예제 #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
}
예제 #4
0
파일: h2spec.go 프로젝트: Lukasa/h2spec
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
}
예제 #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
}