transport: return ErrConnClosing for proper handling (#2644)

transport: return ErrConnClosing for proper handling
This commit is contained in:
Prannay Khosla 2019-02-27 23:06:25 +05:30 committed by Can Guler
parent 3aaef9f0c1
commit a51d23e017
1 changed files with 3 additions and 0 deletions

View File

@ -849,6 +849,9 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error {
if !s.isHeaderSent() { // Headers haven't been written yet.
if err := t.WriteHeader(s, nil); err != nil {
if _, ok := err.(ConnectionError); ok {
return err
}
// TODO(mmukhi, dfawley): Make sure this is the right code to return.
return status.Errorf(codes.Internal, "transport: %v", err)
}