|
|
@@ -936,9 +936,15 @@ func (sc *serverConn) startFrameWrite(wr FrameWriteRequest) {
|
|
|
if st != nil {
|
|
|
switch st.state {
|
|
|
case stateHalfClosedLocal:
|
|
|
- panic("internal error: attempt to send frame on half-closed-local stream")
|
|
|
+ switch wr.write.(type) {
|
|
|
+ case StreamError, handlerPanicRST, writeWindowUpdate:
|
|
|
+ // RFC 7540 Section 5.1 allows sending RST_STREAM, PRIORITY, and WINDOW_UPDATE
|
|
|
+ // in this state. (We never send PRIORITY from the server, so that is not checked.)
|
|
|
+ default:
|
|
|
+ panic(fmt.Sprintf("internal error: attempt to send frame on a half-closed-local stream: %v", wr))
|
|
|
+ }
|
|
|
case stateClosed:
|
|
|
- panic(fmt.Sprintf("internal error: attempt to send a write %v on a closed stream", wr))
|
|
|
+ panic(fmt.Sprintf("internal error: attempt to send frame a closed stream: %v", wr))
|
|
|
}
|
|
|
}
|
|
|
if wpp, ok := wr.write.(*writePushPromise); ok {
|