internal/transport: remove unnecessary ServerTransport method (#2224)

This commit is contained in:
dfawley
2018-07-17 08:26:04 -07:00
committed by GitHub
parent a7d6032db4
commit b534d2d20e
2 changed files with 3 additions and 10 deletions

View File

@ -307,12 +307,6 @@ func (s *Stream) Trailer() metadata.MD {
return c return c
} }
// ServerTransport returns the underlying ServerTransport for the stream.
// The client side stream always returns nil.
func (s *Stream) ServerTransport() ServerTransport {
return s.st
}
// ContentSubtype returns the content-subtype for a request. For example, a // ContentSubtype returns the content-subtype for a request. For example, a
// content-subtype of "proto" will result in a content-type of // content-subtype of "proto" will result in a content-type of
// "application/grpc+proto". This will always be lowercase. See // "application/grpc+proto". This will always be lowercase. See
@ -359,8 +353,7 @@ func (s *Stream) SetHeader(md metadata.MD) error {
// combined with any metadata set by previous calls to SetHeader and // combined with any metadata set by previous calls to SetHeader and
// then written to the transport stream. // then written to the transport stream.
func (s *Stream) SendHeader(md metadata.MD) error { func (s *Stream) SendHeader(md metadata.MD) error {
t := s.ServerTransport() return s.st.WriteHeader(s, md)
return t.WriteHeader(s, md)
} }
// SetTrailer sets the trailer metadata which will be sent with the RPC status // SetTrailer sets the trailer metadata which will be sent with the RPC status

View File

@ -140,9 +140,9 @@ func (h *testStreamHandler) handleStreamPingPong(t *testing.T, s *Stream) {
} }
func (h *testStreamHandler) handleStreamMisbehave(t *testing.T, s *Stream) { func (h *testStreamHandler) handleStreamMisbehave(t *testing.T, s *Stream) {
conn, ok := s.ServerTransport().(*http2Server) conn, ok := s.st.(*http2Server)
if !ok { if !ok {
t.Fatalf("Failed to convert %v to *http2Server", s.ServerTransport()) t.Fatalf("Failed to convert %v to *http2Server", s.st)
} }
var sent int var sent int
p := make([]byte, http2MaxFrameLen) p := make([]byte, http2MaxFrameLen)