MCPcopy
hub / github.com/grpc/grpc-go / cleanupStreamHandler

Method cleanupStreamHandler

internal/transport/controlbuf.go:808–835  ·  view source on GitHub ↗
(c *cleanupStream)

Source from the content-addressed store, hash-verified

806}
807
808func (l *loopyWriter) cleanupStreamHandler(c *cleanupStream) error {
809 c.onWrite()
810 if str, ok := l.estdStreams[c.streamID]; ok {
811 // On the server side it could be a trailers-only response or
812 // a RST_STREAM before stream initialization thus the stream might
813 // not be established yet.
814 delete(l.estdStreams, c.streamID)
815 str.reader.Close()
816 str.deleteSelf()
817 for head := str.itl.dequeueAll(); head != nil; head = head.next {
818 if df, ok := head.it.(*dataFrame); ok {
819 if !df.processing {
820 df.data.Free()
821 }
822 }
823 }
824 }
825 if c.rst { // If RST_STREAM needs to be sent.
826 if err := l.framer.fr.WriteRSTStream(c.streamID, c.rstCode); err != nil {
827 return err
828 }
829 }
830 if l.draining && len(l.estdStreams) == 0 {
831 // Flush and close the connection; we are done with it.
832 return errors.New("finished processing active streams while in draining mode")
833 }
834 return nil
835}
836
837func (l *loopyWriter) earlyAbortStreamHandler(eas *earlyAbortStream) error {
838 if l.side == clientSide {

Callers 3

headerHandlerMethod · 0.95
handleMethod · 0.95

Calls 4

deleteSelfMethod · 0.80
dequeueAllMethod · 0.80
CloseMethod · 0.65
FreeMethod · 0.65

Tested by

no test coverage detected