diff --git a/balancer.go b/balancer.go index e1730166..5aeb646d 100644 --- a/balancer.go +++ b/balancer.go @@ -19,7 +19,6 @@ package grpc import ( - "fmt" "net" "sync" @@ -118,26 +117,6 @@ type Balancer interface { Close() error } -// downErr implements net.Error. It is constructed by gRPC internals and passed to the down -// call of Balancer. -type downErr struct { - timeout bool - temporary bool - desc string -} - -func (e downErr) Error() string { return e.desc } -func (e downErr) Timeout() bool { return e.timeout } -func (e downErr) Temporary() bool { return e.temporary } - -func downErrorf(timeout, temporary bool, format string, a ...interface{}) downErr { - return downErr{ - timeout: timeout, - temporary: temporary, - desc: fmt.Sprintf(format, a...), - } -} - // RoundRobin returns a Balancer that selects addresses round-robin. It uses r to watch // the name resolution updates and updates the addresses available correspondingly. // @@ -410,7 +389,3 @@ func (rr *roundRobin) Close() error { type pickFirst struct { *roundRobin } - -func pickFirstBalancerV1(r naming.Resolver) Balancer { - return &pickFirst{&roundRobin{r: r}} -} diff --git a/balancer_test.go b/balancer_test.go index 8675e7d5..d9b2eebe 100644 --- a/balancer_test.go +++ b/balancer_test.go @@ -39,6 +39,10 @@ import ( _ "google.golang.org/grpc/resolver/passthrough" ) +func pickFirstBalancerV1(r naming.Resolver) Balancer { + return &pickFirst{&roundRobin{r: r}} +} + type testWatcher struct { // the channel to receives name resolution updates update chan *naming.Update diff --git a/channelz/service/service.go b/channelz/service/service.go index 1cc607e6..4ffe1344 100644 --- a/channelz/service/service.go +++ b/channelz/service/service.go @@ -47,7 +47,7 @@ func convertToPtypesDuration(sec int64, usec int64) *durpb.Duration { // RegisterChannelzServiceToServer registers the channelz service to the given server. func RegisterChannelzServiceToServer(s *grpc.Server) { - channelzgrpc.RegisterChannelzServer(s, &serverImpl{}) + channelzgrpc.RegisterChannelzServer(s, newCZServer()) } func newCZServer() channelzgrpc.ChannelzServer { diff --git a/clientconn.go b/clientconn.go index bb6aeb8c..318ac407 100644 --- a/clientconn.go +++ b/clientconn.go @@ -65,8 +65,6 @@ var ( errConnDrain = errors.New("grpc: the connection is drained") // errConnClosing indicates that the connection is closing. errConnClosing = errors.New("grpc: the connection is closing") - // errConnUnavailable indicates that the connection is unavailable. - errConnUnavailable = errors.New("grpc: the connection is unavailable") // errBalancerClosed indicates that the balancer is closed. errBalancerClosed = errors.New("grpc: balancer is closed") // We use an accessor so that minConnectTimeout can be @@ -89,8 +87,6 @@ var ( // errCredentialsConflict indicates that grpc.WithTransportCredentials() // and grpc.WithInsecure() are both called for a connection. errCredentialsConflict = errors.New("grpc: transport credentials are set for an insecure connection (grpc.WithTransportCredentials() and grpc.WithInsecure() are both called)") - // errNetworkIO indicates that the connection is down due to some network I/O error. - errNetworkIO = errors.New("grpc: failed with network I/O error") ) const ( @@ -856,14 +852,6 @@ func (ac *addrConn) printf(format string, a ...interface{}) { } } -// errorf records an error in ac's event log, unless ac has been closed. -// REQUIRES ac.mu is held. -func (ac *addrConn) errorf(format string, a ...interface{}) { - if ac.events != nil { - ac.events.Errorf(format, a...) - } -} - // resetTransport recreates a transport to the address for ac. The old // transport will close itself on error or when the clientconn is closed. // The created transport must receive initial settings frame from the server. diff --git a/credentials/alts/utils.go b/credentials/alts/utils.go index 4cd1f8c9..49bdcdf7 100644 --- a/credentials/alts/utils.go +++ b/credentials/alts/utils.go @@ -29,7 +29,6 @@ import ( "regexp" "runtime" "strings" - "time" "golang.org/x/net/context" "google.golang.org/grpc/peer" @@ -41,7 +40,6 @@ const ( windowsCheckCommandArgs = "Get-WmiObject -Class Win32_BIOS" powershellOutputFilter = "Manufacturer" windowsManufacturerRegex = ":(.*)" - windowsCheckTimeout = 30 * time.Second ) type platformError string diff --git a/internal/transport/controlbuf.go b/internal/transport/controlbuf.go index ce135c4d..204ba158 100644 --- a/internal/transport/controlbuf.go +++ b/internal/transport/controlbuf.go @@ -104,7 +104,6 @@ type headerFrame struct { type cleanupStream struct { streamID uint32 - idPtr *uint32 rst bool rstCode http2.ErrCode onWrite func() @@ -138,9 +137,6 @@ type outgoingSettings struct { ss []http2.Setting } -type settingsAck struct { -} - type incomingGoAway struct { } diff --git a/internal/transport/handler_server_test.go b/internal/transport/handler_server_test.go index da04e7ce..d4e2ce3b 100644 --- a/internal/transport/handler_server_test.go +++ b/internal/transport/handler_server_test.go @@ -252,7 +252,6 @@ func newTestHandlerResponseWriter() http.ResponseWriter { type handleStreamTest struct { t *testing.T bodyw *io.PipeWriter - req *http.Request rw testHandlerResponseWriter ht *serverHandlerTransport } diff --git a/internal/transport/log.go b/internal/transport/log.go index ac8e358c..879df80c 100644 --- a/internal/transport/log.go +++ b/internal/transport/log.go @@ -42,9 +42,3 @@ func errorf(format string, args ...interface{}) { grpclog.Errorf(format, args...) } } - -func fatalf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Fatalf(format, args...) - } -} diff --git a/internal/transport/transport.go b/internal/transport/transport.go index 644cf11c..fdf8ad68 100644 --- a/internal/transport/transport.go +++ b/internal/transport/transport.go @@ -176,7 +176,6 @@ type Stream struct { buf *recvBuffer trReader io.Reader fc *inFlow - recvQuota uint32 wq *writeQuota // Callback to state application's intentions to read data. This diff --git a/internal/transport/transport_test.go b/internal/transport/transport_test.go index 52be96f0..109b37bc 100644 --- a/internal/transport/transport_test.go +++ b/internal/transport/transport_test.go @@ -1747,13 +1747,6 @@ func TestContextErr(t *testing.T) { } } -func max(a, b int32) int32 { - if a > b { - return a - } - return b -} - type windowSizeConfig struct { serverStream int32 serverConn int32 diff --git a/interop/alts/client/client.go b/interop/alts/client/client.go index 3710c4b3..b0776107 100644 --- a/interop/alts/client/client.go +++ b/interop/alts/client/client.go @@ -30,10 +30,6 @@ import ( testpb "google.golang.org/grpc/interop/grpc_testing" ) -const ( - value = "test_value" -) - var ( hsAddr = flag.String("alts_handshaker_service_address", "", "ALTS handshaker gRPC service address") serverAddr = flag.String("server_address", ":8080", "The port on which the server is listening") diff --git a/rpc_util.go b/rpc_util.go index 207f0ee6..fa056830 100644 --- a/rpc_util.go +++ b/rpc_util.go @@ -156,13 +156,11 @@ type callInfo struct { compressorType string failFast bool stream *clientStream - traceInfo traceInfo // in trace.go maxReceiveMessageSize *int maxSendMessageSize *int creds credentials.PerRPCCredentials contentSubtype string codec baseCodec - disableRetry bool maxRetryRPCBufferSize int } diff --git a/stats/stats_test.go b/stats/stats_test.go index 00a5e4f3..c48143a3 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -403,7 +403,7 @@ const ( inTrailer outPayload outHeader - outTrailer + // TODO: test outTrailer ? connbegin connend ) diff --git a/test/end2end_test.go b/test/end2end_test.go index 818532c2..c80804e8 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -3059,10 +3059,6 @@ func testSetAndSendHeaderStreamingRPC(t *testing.T, e env) { defer te.tearDown() tc := testpb.NewTestServiceClient(te.clientConn()) - const ( - argSize = 1 - respSize = 1 - ) ctx := metadata.NewOutgoingContext(context.Background(), testMetadata) stream, err := tc.FullDuplexCall(ctx) if err != nil { @@ -4659,9 +4655,7 @@ func TestCredsHandshakeAuthority(t *testing.T) { } } -type clientFailCreds struct { - got string -} +type clientFailCreds struct{} func (c *clientFailCreds) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { return rawConn, nil, nil