func (s *RequestStream) shutdown() { s.writeHeader() if s.state != nil { if s.state.OpenThere() { // Send the RST_STREAM. rst := new(frames.RST_STREAM) rst.StreamID = s.streamID rst.Status = common.RST_STREAM_CANCEL s.output <- rst } s.state.Close() } select { case <-s.finished: default: close(s.finished) } select { case <-s.headerChan: default: close(s.headerChan) } s.conn.requestStreamLimit.Close() s.output = nil s.Request = nil s.Receiver = nil s.header = nil s.stop = nil }
// protocolError informs the other endpoint that a protocol error has // occurred, stops all running streams, and ends the connection. func (c *Conn) protocolError(streamID common.StreamID) { reply := new(frames.RST_STREAM) reply.StreamID = streamID reply.Status = common.RST_STREAM_PROTOCOL_ERROR select { case c.output[0] <- reply: case <-time.After(100 * time.Millisecond): debug.Println("Failed to send PROTOCOL_ERROR RST_STREAM.") } c.shutdownError = reply c.Close() }
func (c *Conn) _RST_STREAM(streamID common.StreamID, status common.StatusCode) { rst := new(frames.RST_STREAM) rst.StreamID = streamID rst.Status = status c.output[0] <- rst }