(err error)
| 823 | } |
| 824 | |
| 825 | func (hc *connectStreamingHandlerConn) Close(err error) error { |
| 826 | defer flushResponseWriter(hc.responseWriter) |
| 827 | if err := hc.marshaler.MarshalEndStream(err, hc.responseTrailer); err != nil { |
| 828 | _ = hc.request.Body.Close() |
| 829 | return err |
| 830 | } |
| 831 | // We don't want to copy unread portions of the body to /dev/null here: if |
| 832 | // the client hasn't closed the request body, we'll block until the server |
| 833 | // timeout kicks in. This could happen because the client is malicious, but |
| 834 | // a well-intentioned client may just not expect the server to be returning |
| 835 | // an error for a streaming RPC. Better to accept that we can't always reuse |
| 836 | // TCP connections. |
| 837 | if err := hc.request.Body.Close(); err != nil { |
| 838 | if connectErr, ok := asError(err); ok { |
| 839 | return connectErr |
| 840 | } |
| 841 | return NewError(CodeUnknown, err) |
| 842 | } |
| 843 | return nil // must be a literal nil: nil *Error is a non-nil error |
| 844 | } |
| 845 | |
| 846 | type connectStreamingMarshaler struct { |
| 847 | envelopeWriter |
nothing calls this directly
no test coverage detected