mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
vendor update for CSI 0.3.0
This commit is contained in:
1199
vendor/google.golang.org/grpc/test/channelz_test.go
generated
vendored
Normal file
1199
vendor/google.golang.org/grpc/test/channelz_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
45
vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go
generated
vendored
45
vendor/google.golang.org/grpc/test/codec_perf/perf.pb.go
generated
vendored
@ -1,15 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: codec_perf/perf.proto
|
||||
|
||||
/*
|
||||
Package codec_perf is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
codec_perf/perf.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Buffer
|
||||
*/
|
||||
package codec_perf
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
@ -30,13 +21,35 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
// Buffer is a message that contains a body of bytes that is used to exercise
|
||||
// encoding and decoding overheads.
|
||||
type Buffer struct {
|
||||
Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Body []byte `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Buffer) Reset() { *m = Buffer{} }
|
||||
func (m *Buffer) String() string { return proto.CompactTextString(m) }
|
||||
func (*Buffer) ProtoMessage() {}
|
||||
func (*Buffer) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (m *Buffer) Reset() { *m = Buffer{} }
|
||||
func (m *Buffer) String() string { return proto.CompactTextString(m) }
|
||||
func (*Buffer) ProtoMessage() {}
|
||||
func (*Buffer) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_perf_6cc81a33b24d08e7, []int{0}
|
||||
}
|
||||
func (m *Buffer) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Buffer.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Buffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Buffer.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Buffer) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Buffer.Merge(dst, src)
|
||||
}
|
||||
func (m *Buffer) XXX_Size() int {
|
||||
return xxx_messageInfo_Buffer.Size(m)
|
||||
}
|
||||
func (m *Buffer) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Buffer.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Buffer proto.InternalMessageInfo
|
||||
|
||||
func (m *Buffer) GetBody() []byte {
|
||||
if m != nil {
|
||||
@ -49,9 +62,9 @@ func init() {
|
||||
proto.RegisterType((*Buffer)(nil), "codec.perf.Buffer")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("codec_perf/perf.proto", fileDescriptor0) }
|
||||
func init() { proto.RegisterFile("codec_perf/perf.proto", fileDescriptor_perf_6cc81a33b24d08e7) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
var fileDescriptor_perf_6cc81a33b24d08e7 = []byte{
|
||||
// 83 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4d, 0xce, 0x4f, 0x49,
|
||||
0x4d, 0x8e, 0x2f, 0x48, 0x2d, 0x4a, 0xd3, 0x07, 0x11, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42,
|
||||
|
434
vendor/google.golang.org/grpc/test/end2end_test.go
generated
vendored
434
vendor/google.golang.org/grpc/test/end2end_test.go
generated
vendored
@ -53,8 +53,11 @@ import (
|
||||
_ "google.golang.org/grpc/encoding/gzip"
|
||||
_ "google.golang.org/grpc/grpclog/glogger"
|
||||
"google.golang.org/grpc/health"
|
||||
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
|
||||
healthpb "google.golang.org/grpc/health/grpc_health_v1"
|
||||
"google.golang.org/grpc/internal"
|
||||
"google.golang.org/grpc/internal/leakcheck"
|
||||
"google.golang.org/grpc/keepalive"
|
||||
"google.golang.org/grpc/metadata"
|
||||
"google.golang.org/grpc/peer"
|
||||
"google.golang.org/grpc/resolver"
|
||||
@ -64,10 +67,13 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/grpc/tap"
|
||||
testpb "google.golang.org/grpc/test/grpc_testing"
|
||||
"google.golang.org/grpc/test/leakcheck"
|
||||
"google.golang.org/grpc/testdata"
|
||||
)
|
||||
|
||||
func init() {
|
||||
grpc.RegisterChannelz()
|
||||
}
|
||||
|
||||
var (
|
||||
// For headers:
|
||||
testMetadata = metadata.MD{
|
||||
@ -469,6 +475,8 @@ type test struct {
|
||||
perRPCCreds credentials.PerRPCCredentials
|
||||
customDialOptions []grpc.DialOption
|
||||
resolverScheme string
|
||||
cliKeepAlive *keepalive.ClientParameters
|
||||
svrKeepAlive *keepalive.ServerParameters
|
||||
|
||||
// All test dialing is blocking by default. Set this to true if dial
|
||||
// should be non-blocking.
|
||||
@ -478,6 +486,10 @@ type test struct {
|
||||
srv *grpc.Server
|
||||
srvAddr string
|
||||
|
||||
// srvs and srvAddrs are set once startServers is called.
|
||||
srvs []*grpc.Server
|
||||
srvAddrs []string
|
||||
|
||||
cc *grpc.ClientConn // nil until requested via clientConn
|
||||
restoreLogs func() // nil unless declareLogNoise is used
|
||||
}
|
||||
@ -487,17 +499,25 @@ func (te *test) tearDown() {
|
||||
te.cancel()
|
||||
te.cancel = nil
|
||||
}
|
||||
|
||||
if te.cc != nil {
|
||||
te.cc.Close()
|
||||
te.cc = nil
|
||||
}
|
||||
|
||||
if te.restoreLogs != nil {
|
||||
te.restoreLogs()
|
||||
te.restoreLogs = nil
|
||||
}
|
||||
|
||||
if te.srv != nil {
|
||||
te.srv.Stop()
|
||||
}
|
||||
if len(te.srvs) != 0 {
|
||||
for _, s := range te.srvs {
|
||||
s.Stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// newTest returns a new test using the provided testing.T and
|
||||
@ -513,9 +533,7 @@ func newTest(t *testing.T, e env) *test {
|
||||
return te
|
||||
}
|
||||
|
||||
// startServer starts a gRPC server listening. Callers should defer a
|
||||
// call to te.tearDown to clean up.
|
||||
func (te *test) startServer(ts testpb.TestServiceServer) {
|
||||
func (te *test) listenAndServe(ts testpb.TestServiceServer, listen func(network, address string) (net.Listener, error)) net.Listener {
|
||||
te.testServer = ts
|
||||
te.t.Logf("Running test in %s environment...", te.e.name)
|
||||
sopts := []grpc.ServerOption{grpc.MaxConcurrentStreams(te.maxStream)}
|
||||
@ -558,7 +576,7 @@ func (te *test) startServer(ts testpb.TestServiceServer) {
|
||||
la = "/tmp/testsock" + fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
syscall.Unlink(la)
|
||||
}
|
||||
lis, err := net.Listen(te.e.network, la)
|
||||
lis, err := listen(te.e.network, la)
|
||||
if err != nil {
|
||||
te.t.Fatalf("Failed to listen: %v", err)
|
||||
}
|
||||
@ -575,13 +593,16 @@ func (te *test) startServer(ts testpb.TestServiceServer) {
|
||||
if te.customCodec != nil {
|
||||
sopts = append(sopts, grpc.CustomCodec(te.customCodec))
|
||||
}
|
||||
if te.svrKeepAlive != nil {
|
||||
sopts = append(sopts, grpc.KeepaliveParams(*te.svrKeepAlive))
|
||||
}
|
||||
s := grpc.NewServer(sopts...)
|
||||
te.srv = s
|
||||
if te.e.httpHandler {
|
||||
internal.TestingUseHandlerImpl(s)
|
||||
}
|
||||
if te.healthServer != nil {
|
||||
healthpb.RegisterHealthServer(s, te.healthServer)
|
||||
healthgrpc.RegisterHealthServer(s, te.healthServer)
|
||||
}
|
||||
if te.testServer != nil {
|
||||
testpb.RegisterTestServiceServer(s, te.testServer)
|
||||
@ -599,6 +620,18 @@ func (te *test) startServer(ts testpb.TestServiceServer) {
|
||||
|
||||
go s.Serve(lis)
|
||||
te.srvAddr = addr
|
||||
return lis
|
||||
}
|
||||
|
||||
func (te *test) startServerWithConnControl(ts testpb.TestServiceServer) *listenerWrapper {
|
||||
l := te.listenAndServe(ts, listenWithConnControl)
|
||||
return l.(*listenerWrapper)
|
||||
}
|
||||
|
||||
// startServer starts a gRPC server listening. Callers should defer a
|
||||
// call to te.tearDown to clean up.
|
||||
func (te *test) startServer(ts testpb.TestServiceServer) {
|
||||
te.listenAndServe(ts, net.Listen)
|
||||
}
|
||||
|
||||
type nopCompressor struct {
|
||||
@ -627,14 +660,8 @@ func (d *nopDecompressor) Type() string {
|
||||
return "nop"
|
||||
}
|
||||
|
||||
func (te *test) clientConn() *grpc.ClientConn {
|
||||
if te.cc != nil {
|
||||
return te.cc
|
||||
}
|
||||
opts := []grpc.DialOption{
|
||||
grpc.WithDialer(te.e.dialer),
|
||||
grpc.WithUserAgent(te.userAgent),
|
||||
}
|
||||
func (te *test) configDial(opts ...grpc.DialOption) ([]grpc.DialOption, string) {
|
||||
opts = append(opts, grpc.WithDialer(te.e.dialer), grpc.WithUserAgent(te.userAgent))
|
||||
|
||||
if te.sc != nil {
|
||||
opts = append(opts, grpc.WithServiceConfig(te.sc))
|
||||
@ -714,7 +741,35 @@ func (te *test) clientConn() *grpc.ClientConn {
|
||||
if te.srvAddr == "" {
|
||||
te.srvAddr = "client.side.only.test"
|
||||
}
|
||||
if te.cliKeepAlive != nil {
|
||||
opts = append(opts, grpc.WithKeepaliveParams(*te.cliKeepAlive))
|
||||
}
|
||||
opts = append(opts, te.customDialOptions...)
|
||||
return opts, scheme
|
||||
}
|
||||
|
||||
func (te *test) clientConnWithConnControl() (*grpc.ClientConn, *dialerWrapper) {
|
||||
if te.cc != nil {
|
||||
return te.cc, nil
|
||||
}
|
||||
opts, scheme := te.configDial()
|
||||
dw := &dialerWrapper{}
|
||||
// overwrite the dialer before
|
||||
opts = append(opts, grpc.WithDialer(dw.dialer))
|
||||
var err error
|
||||
te.cc, err = grpc.Dial(scheme+te.srvAddr, opts...)
|
||||
if err != nil {
|
||||
te.t.Fatalf("Dial(%q) = %v", scheme+te.srvAddr, err)
|
||||
}
|
||||
return te.cc, dw
|
||||
}
|
||||
|
||||
func (te *test) clientConn(opts ...grpc.DialOption) *grpc.ClientConn {
|
||||
if te.cc != nil {
|
||||
return te.cc
|
||||
}
|
||||
var scheme string
|
||||
opts, scheme = te.configDial(opts...)
|
||||
var err error
|
||||
te.cc, err = grpc.Dial(scheme+te.srvAddr, opts...)
|
||||
if err != nil {
|
||||
@ -751,7 +806,6 @@ type lazyConn struct {
|
||||
|
||||
func (l *lazyConn) Write(b []byte) (int, error) {
|
||||
if atomic.LoadInt32(&(l.beLazy)) == 1 {
|
||||
// The sleep duration here needs to less than the leakCheck deadline.
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
return l.Conn.Write(b)
|
||||
@ -940,18 +994,18 @@ func testServerGoAwayPendingRPC(t *testing.T, e env) {
|
||||
close(ch)
|
||||
}()
|
||||
// Loop until the server side GoAway signal is propagated to the client.
|
||||
abort := false
|
||||
time.AfterFunc(time.Second, func() { abort = true })
|
||||
for !abort {
|
||||
start := time.Now()
|
||||
errored := false
|
||||
for time.Since(start) < time.Second {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Millisecond)
|
||||
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); err != nil {
|
||||
cancel()
|
||||
_, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false))
|
||||
cancel()
|
||||
if err != nil {
|
||||
errored = true
|
||||
break
|
||||
}
|
||||
cancel()
|
||||
}
|
||||
// Don't bother stopping the timer; it will have no effect past here.
|
||||
if abort {
|
||||
if !errored {
|
||||
t.Fatalf("GoAway never received by client")
|
||||
}
|
||||
respParam := []*testpb.ResponseParameters{{Size: 1}}
|
||||
@ -966,7 +1020,7 @@ func testServerGoAwayPendingRPC(t *testing.T, e env) {
|
||||
}
|
||||
// The existing RPC should be still good to proceed.
|
||||
if err := stream.Send(req); err != nil {
|
||||
t.Fatalf("%v.Send(%v) = %v, want <nil>", stream, req, err)
|
||||
t.Fatalf("%v.Send(_) = %v, want <nil>", stream, err)
|
||||
}
|
||||
if _, err := stream.Recv(); err != nil {
|
||||
t.Fatalf("%v.Recv() = _, %v, want _, <nil>", stream, err)
|
||||
@ -1247,7 +1301,7 @@ func testFailFast(t *testing.T, e env) {
|
||||
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}); err != nil {
|
||||
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
|
||||
}
|
||||
// Stop the server and tear down all the exisiting connections.
|
||||
// Stop the server and tear down all the existing connections.
|
||||
te.srv.Stop()
|
||||
// Loop until the server teardown is propagated to the client.
|
||||
for {
|
||||
@ -2199,7 +2253,7 @@ func testTap(t *testing.T, e env) {
|
||||
func healthCheck(d time.Duration, cc *grpc.ClientConn, serviceName string) (*healthpb.HealthCheckResponse, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), d)
|
||||
defer cancel()
|
||||
hc := healthpb.NewHealthClient(cc)
|
||||
hc := healthgrpc.NewHealthClient(cc)
|
||||
req := &healthpb.HealthCheckRequest{
|
||||
Service: serviceName,
|
||||
}
|
||||
@ -3056,7 +3110,6 @@ func testMultipleSetHeaderStreamingRPCError(t *testing.T, e env) {
|
||||
if !reflect.DeepEqual(header, expectedHeader) {
|
||||
t.Fatalf("Received header metadata %v, want %v", header, expectedHeader)
|
||||
}
|
||||
|
||||
if err := stream.CloseSend(); err != nil {
|
||||
t.Fatalf("%v.CloseSend() got %v, want %v", stream, err, nil)
|
||||
}
|
||||
@ -3159,44 +3212,6 @@ func testRetry(t *testing.T, e env) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRPCTimeout(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
for _, e := range listTestEnv() {
|
||||
testRPCTimeout(t, e)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(zhaoq): Have a better test coverage of timeout and cancellation mechanism.
|
||||
func testRPCTimeout(t *testing.T, e env) {
|
||||
te := newTest(t, e)
|
||||
te.startServer(&testServer{security: e.security, unaryCallSleepTime: 50 * time.Millisecond})
|
||||
defer te.tearDown()
|
||||
|
||||
cc := te.clientConn()
|
||||
tc := testpb.NewTestServiceClient(cc)
|
||||
|
||||
const argSize = 2718
|
||||
const respSize = 314
|
||||
|
||||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req := &testpb.SimpleRequest{
|
||||
ResponseType: testpb.PayloadType_COMPRESSABLE,
|
||||
ResponseSize: respSize,
|
||||
Payload: payload,
|
||||
}
|
||||
for i := -1; i <= 10; i++ {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(i)*time.Millisecond)
|
||||
if _, err := tc.UnaryCall(ctx, req); status.Code(err) != codes.DeadlineExceeded {
|
||||
t.Fatalf("TestService/UnaryCallv(_, _) = _, %v; want <nil>, error code: %s", err, codes.DeadlineExceeded)
|
||||
}
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
|
||||
func TestCancel(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
for _, e := range listTestEnv() {
|
||||
@ -3690,7 +3705,7 @@ func testClientStreaming(t *testing.T, e env, sizes []int) {
|
||||
Payload: payload,
|
||||
}
|
||||
if err := stream.Send(req); err != nil {
|
||||
t.Fatalf("%v.Send(%v) = %v, want <nil>", stream, req, err)
|
||||
t.Fatalf("%v.Send(_) = %v, want <nil>", stream, err)
|
||||
}
|
||||
sum += s
|
||||
}
|
||||
@ -4871,6 +4886,34 @@ func (ss *stubServer) Stop() {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGRPCMethod(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
var method string
|
||||
var ok bool
|
||||
|
||||
ss := &stubServer{
|
||||
emptyCall: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
|
||||
method, ok = grpc.Method(ctx)
|
||||
return &testpb.Empty{}, nil
|
||||
},
|
||||
}
|
||||
if err := ss.Start(nil); err != nil {
|
||||
t.Fatalf("Error starting endpoint server: %v", err)
|
||||
}
|
||||
defer ss.Stop()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if _, err := ss.client.EmptyCall(ctx, &testpb.Empty{}); err != nil {
|
||||
t.Fatalf("ss.client.EmptyCall(_, _) = _, %v; want _, nil", err)
|
||||
}
|
||||
|
||||
if want := "/grpc.testing.TestService/EmptyCall"; !ok || method != want {
|
||||
t.Fatalf("grpc.Method(_) = %q, %v; want %q, true", method, ok, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnaryProxyDoesNotForwardMetadata(t *testing.T) {
|
||||
const mdkey = "somedata"
|
||||
|
||||
@ -5053,7 +5096,7 @@ func TestTapTimeout(t *testing.T) {
|
||||
ss := &stubServer{
|
||||
emptyCall: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
|
||||
<-ctx.Done()
|
||||
return &testpb.Empty{}, nil
|
||||
return nil, status.Errorf(codes.Canceled, ctx.Err().Error())
|
||||
},
|
||||
}
|
||||
if err := ss.Start(sopts); err != nil {
|
||||
@ -5887,6 +5930,109 @@ func TestMethodFromServerStream(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInterceptorCanAccessCallOptions(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
e := tcpClearRREnv
|
||||
te := newTest(t, e)
|
||||
te.startServer(&testServer{security: e.security})
|
||||
defer te.tearDown()
|
||||
|
||||
type observedOptions struct {
|
||||
headers []*metadata.MD
|
||||
trailers []*metadata.MD
|
||||
peer []*peer.Peer
|
||||
creds []credentials.PerRPCCredentials
|
||||
failFast []bool
|
||||
maxRecvSize []int
|
||||
maxSendSize []int
|
||||
compressor []string
|
||||
subtype []string
|
||||
}
|
||||
var observedOpts observedOptions
|
||||
populateOpts := func(opts []grpc.CallOption) {
|
||||
for _, o := range opts {
|
||||
switch o := o.(type) {
|
||||
case grpc.HeaderCallOption:
|
||||
observedOpts.headers = append(observedOpts.headers, o.HeaderAddr)
|
||||
case grpc.TrailerCallOption:
|
||||
observedOpts.trailers = append(observedOpts.trailers, o.TrailerAddr)
|
||||
case grpc.PeerCallOption:
|
||||
observedOpts.peer = append(observedOpts.peer, o.PeerAddr)
|
||||
case grpc.PerRPCCredsCallOption:
|
||||
observedOpts.creds = append(observedOpts.creds, o.Creds)
|
||||
case grpc.FailFastCallOption:
|
||||
observedOpts.failFast = append(observedOpts.failFast, o.FailFast)
|
||||
case grpc.MaxRecvMsgSizeCallOption:
|
||||
observedOpts.maxRecvSize = append(observedOpts.maxRecvSize, o.MaxRecvMsgSize)
|
||||
case grpc.MaxSendMsgSizeCallOption:
|
||||
observedOpts.maxSendSize = append(observedOpts.maxSendSize, o.MaxSendMsgSize)
|
||||
case grpc.CompressorCallOption:
|
||||
observedOpts.compressor = append(observedOpts.compressor, o.CompressorType)
|
||||
case grpc.ContentSubtypeCallOption:
|
||||
observedOpts.subtype = append(observedOpts.subtype, o.ContentSubtype)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
te.unaryClientInt = func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error {
|
||||
populateOpts(opts)
|
||||
return nil
|
||||
}
|
||||
te.streamClientInt = func(ctx context.Context, desc *grpc.StreamDesc, cc *grpc.ClientConn, method string, streamer grpc.Streamer, opts ...grpc.CallOption) (grpc.ClientStream, error) {
|
||||
populateOpts(opts)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
defaults := []grpc.CallOption{
|
||||
grpc.FailFast(false),
|
||||
grpc.MaxCallRecvMsgSize(1010),
|
||||
}
|
||||
tc := testpb.NewTestServiceClient(te.clientConn(grpc.WithDefaultCallOptions(defaults...)))
|
||||
|
||||
var headers metadata.MD
|
||||
var trailers metadata.MD
|
||||
var pr peer.Peer
|
||||
tc.UnaryCall(context.Background(), &testpb.SimpleRequest{},
|
||||
grpc.MaxCallRecvMsgSize(100),
|
||||
grpc.MaxCallSendMsgSize(200),
|
||||
grpc.PerRPCCredentials(testPerRPCCredentials{}),
|
||||
grpc.Header(&headers),
|
||||
grpc.Trailer(&trailers),
|
||||
grpc.Peer(&pr))
|
||||
expected := observedOptions{
|
||||
failFast: []bool{false},
|
||||
maxRecvSize: []int{1010, 100},
|
||||
maxSendSize: []int{200},
|
||||
creds: []credentials.PerRPCCredentials{testPerRPCCredentials{}},
|
||||
headers: []*metadata.MD{&headers},
|
||||
trailers: []*metadata.MD{&trailers},
|
||||
peer: []*peer.Peer{&pr},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expected, observedOpts) {
|
||||
t.Errorf("unary call did not observe expected options: expected %#v, got %#v", expected, observedOpts)
|
||||
}
|
||||
|
||||
observedOpts = observedOptions{} // reset
|
||||
|
||||
tc.StreamingInputCall(context.Background(),
|
||||
grpc.FailFast(true),
|
||||
grpc.MaxCallSendMsgSize(2020),
|
||||
grpc.UseCompressor("comp-type"),
|
||||
grpc.CallContentSubtype("json"))
|
||||
expected = observedOptions{
|
||||
failFast: []bool{false, true},
|
||||
maxRecvSize: []int{1010},
|
||||
maxSendSize: []int{2020},
|
||||
compressor: []string{"comp-type"},
|
||||
subtype: []string{"json"},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(expected, observedOpts) {
|
||||
t.Errorf("streaming call did not observe expected options: expected %#v, got %#v", expected, observedOpts)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompressorRegister(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
for _, e := range listTestEnv() {
|
||||
@ -5997,6 +6143,73 @@ func TestServeExitsWhenListenerClosed(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Service handler returns status with invalid utf8 message.
|
||||
func TestStatusInvalidUTF8Message(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
|
||||
var (
|
||||
origMsg = string([]byte{0xff, 0xfe, 0xfd})
|
||||
wantMsg = "<22><><EFBFBD>"
|
||||
)
|
||||
|
||||
ss := &stubServer{
|
||||
emptyCall: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Internal, origMsg)
|
||||
},
|
||||
}
|
||||
if err := ss.Start(nil); err != nil {
|
||||
t.Fatalf("Error starting endpoint server: %v", err)
|
||||
}
|
||||
defer ss.Stop()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if _, err := ss.client.EmptyCall(ctx, &testpb.Empty{}); status.Convert(err).Message() != wantMsg {
|
||||
t.Fatalf("ss.client.EmptyCall(_, _) = _, %v (msg %q); want _, err with msg %q", err, status.Convert(err).Message(), wantMsg)
|
||||
}
|
||||
}
|
||||
|
||||
// Service handler returns status with details and invalid utf8 message. Proto
|
||||
// will fail to marshal the status because of the invalid utf8 message. Details
|
||||
// will be dropped when sending.
|
||||
func TestStatusInvalidUTF8Details(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
|
||||
var (
|
||||
origMsg = string([]byte{0xff, 0xfe, 0xfd})
|
||||
wantMsg = "<22><><EFBFBD>"
|
||||
)
|
||||
|
||||
ss := &stubServer{
|
||||
emptyCall: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
|
||||
st := status.New(codes.Internal, origMsg)
|
||||
st, err := st.WithDetails(&testpb.Empty{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return nil, st.Err()
|
||||
},
|
||||
}
|
||||
if err := ss.Start(nil); err != nil {
|
||||
t.Fatalf("Error starting endpoint server: %v", err)
|
||||
}
|
||||
defer ss.Stop()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
|
||||
_, err := ss.client.EmptyCall(ctx, &testpb.Empty{})
|
||||
st := status.Convert(err)
|
||||
if st.Message() != wantMsg {
|
||||
t.Fatalf("ss.client.EmptyCall(_, _) = _, %v (msg %q); want _, err with msg %q", err, st.Message(), wantMsg)
|
||||
}
|
||||
if len(st.Details()) != 0 {
|
||||
// Details should be dropped on the server side.
|
||||
t.Fatalf("RPC status contain details: %v, want no details", st.Details())
|
||||
}
|
||||
}
|
||||
|
||||
func TestClientDoesntDeadlockWhileWritingErrornousLargeMessages(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
for _, e := range listTestEnv() {
|
||||
@ -6040,3 +6253,90 @@ func testClientDoesntDeadlockWhileWritingErrornousLargeMessages(t *testing.T, e
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
const clientAlwaysFailCredErrorMsg = "clientAlwaysFailCred always fails"
|
||||
|
||||
var errClientAlwaysFailCred = errors.New(clientAlwaysFailCredErrorMsg)
|
||||
|
||||
type clientAlwaysFailCred struct{}
|
||||
|
||||
func (c clientAlwaysFailCred) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) {
|
||||
return nil, nil, errClientAlwaysFailCred
|
||||
}
|
||||
func (c clientAlwaysFailCred) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) {
|
||||
return rawConn, nil, nil
|
||||
}
|
||||
func (c clientAlwaysFailCred) Info() credentials.ProtocolInfo {
|
||||
return credentials.ProtocolInfo{}
|
||||
}
|
||||
func (c clientAlwaysFailCred) Clone() credentials.TransportCredentials {
|
||||
return nil
|
||||
}
|
||||
func (c clientAlwaysFailCred) OverrideServerName(s string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestFailFastRPCErrorOnBadCertificates(t *testing.T) {
|
||||
te := newTest(t, env{name: "bad-cred", network: "tcp", security: "clientAlwaysFailCred", balancer: "round_robin"})
|
||||
te.startServer(&testServer{security: te.e.security})
|
||||
defer te.tearDown()
|
||||
|
||||
opts := []grpc.DialOption{grpc.WithTransportCredentials(clientAlwaysFailCred{})}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
cc, err := grpc.DialContext(ctx, te.srvAddr, opts...)
|
||||
if err != nil {
|
||||
t.Fatalf("Dial(_) = %v, want %v", err, nil)
|
||||
}
|
||||
defer cc.Close()
|
||||
|
||||
tc := testpb.NewTestServiceClient(cc)
|
||||
for i := 0; i < 1000; i++ {
|
||||
// This loop runs for at most 1 second. The first several RPCs will fail
|
||||
// with Unavailable because the connection hasn't started. When the
|
||||
// first connection failed with creds error, the next RPC should also
|
||||
// fail with the expected error.
|
||||
if _, err = tc.EmptyCall(context.Background(), &testpb.Empty{}); strings.Contains(err.Error(), clientAlwaysFailCredErrorMsg) {
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
te.t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want err.Error() contains %q", err, clientAlwaysFailCredErrorMsg)
|
||||
}
|
||||
|
||||
func TestRPCTimeout(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
for _, e := range listTestEnv() {
|
||||
testRPCTimeout(t, e)
|
||||
}
|
||||
}
|
||||
|
||||
func testRPCTimeout(t *testing.T, e env) {
|
||||
te := newTest(t, e)
|
||||
te.startServer(&testServer{security: e.security, unaryCallSleepTime: 500 * time.Millisecond})
|
||||
defer te.tearDown()
|
||||
|
||||
cc := te.clientConn()
|
||||
tc := testpb.NewTestServiceClient(cc)
|
||||
|
||||
const argSize = 2718
|
||||
const respSize = 314
|
||||
|
||||
payload, err := newPayload(testpb.PayloadType_COMPRESSABLE, argSize)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req := &testpb.SimpleRequest{
|
||||
ResponseType: testpb.PayloadType_COMPRESSABLE,
|
||||
ResponseSize: respSize,
|
||||
Payload: payload,
|
||||
}
|
||||
for i := -1; i <= 10; i++ {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(i)*time.Millisecond)
|
||||
if _, err := tc.UnaryCall(ctx, req); status.Code(err) != codes.DeadlineExceeded {
|
||||
t.Fatalf("TestService/UnaryCallv(_, _) = _, %v; want <nil>, error code: %s", err, codes.DeadlineExceeded)
|
||||
}
|
||||
cancel()
|
||||
}
|
||||
}
|
||||
|
81
vendor/google.golang.org/grpc/test/gracefulstop_test.go
generated
vendored
81
vendor/google.golang.org/grpc/test/gracefulstop_test.go
generated
vendored
@ -20,6 +20,7 @@ package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
"testing"
|
||||
@ -27,7 +28,7 @@ import (
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/test/leakcheck"
|
||||
"google.golang.org/grpc/internal/leakcheck"
|
||||
|
||||
testpb "google.golang.org/grpc/test/grpc_testing"
|
||||
)
|
||||
@ -50,7 +51,12 @@ func (d *delayListener) Accept() (net.Conn, error) {
|
||||
return nil, fmt.Errorf("listener is closed")
|
||||
default:
|
||||
close(d.acceptCalled)
|
||||
return d.Listener.Accept()
|
||||
conn, err := d.Listener.Accept()
|
||||
// Allow closing of listener only after accept.
|
||||
// Note: Dial can return successfully, yet Accept
|
||||
// might now have finished.
|
||||
d.allowClose()
|
||||
return conn, err
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,39 +92,19 @@ func (d *delayListener) Dial(to time.Duration) (net.Conn, error) {
|
||||
return d.cc, nil
|
||||
}
|
||||
|
||||
func (d *delayListener) clientWriteCalledChan() <-chan struct{} {
|
||||
return d.cc.writeCalledChan()
|
||||
}
|
||||
|
||||
type delayConn struct {
|
||||
net.Conn
|
||||
blockRead chan struct{}
|
||||
mu sync.Mutex
|
||||
writeCalled chan struct{}
|
||||
blockRead chan struct{}
|
||||
}
|
||||
|
||||
func (d *delayConn) writeCalledChan() <-chan struct{} {
|
||||
d.mu.Lock()
|
||||
defer d.mu.Unlock()
|
||||
d.writeCalled = make(chan struct{})
|
||||
return d.writeCalled
|
||||
}
|
||||
func (d *delayConn) allowRead() {
|
||||
close(d.blockRead)
|
||||
}
|
||||
|
||||
func (d *delayConn) Read(b []byte) (n int, err error) {
|
||||
<-d.blockRead
|
||||
return d.Conn.Read(b)
|
||||
}
|
||||
func (d *delayConn) Write(b []byte) (n int, err error) {
|
||||
d.mu.Lock()
|
||||
if d.writeCalled != nil {
|
||||
close(d.writeCalled)
|
||||
d.writeCalled = nil
|
||||
}
|
||||
d.mu.Unlock()
|
||||
return d.Conn.Write(b)
|
||||
}
|
||||
|
||||
func TestGracefulStop(t *testing.T) {
|
||||
defer leakcheck.Check(t)
|
||||
@ -148,10 +134,16 @@ func TestGracefulStop(t *testing.T) {
|
||||
allowCloseCh: make(chan struct{}),
|
||||
}
|
||||
d := func(_ string, to time.Duration) (net.Conn, error) { return dlis.Dial(to) }
|
||||
serverGotReq := make(chan struct{})
|
||||
|
||||
ss := &stubServer{
|
||||
emptyCall: func(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) {
|
||||
return &testpb.Empty{}, nil
|
||||
fullDuplexCall: func(stream testpb.TestService_FullDuplexCallServer) error {
|
||||
close(serverGotReq)
|
||||
_, err := stream.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return stream.Send(&testpb.StreamingOutputCallResponse{})
|
||||
},
|
||||
}
|
||||
s := grpc.NewServer()
|
||||
@ -182,33 +174,38 @@ func TestGracefulStop(t *testing.T) {
|
||||
|
||||
// Now dial. The listener's Accept method will return a valid connection,
|
||||
// even though GracefulStop has closed the listener.
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, dialCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer dialCancel()
|
||||
cc, err := grpc.DialContext(ctx, "", grpc.WithInsecure(), grpc.WithBlock(), grpc.WithDialer(d))
|
||||
if err != nil {
|
||||
t.Fatalf("grpc.Dial(%q) = %v", lis.Addr().String(), err)
|
||||
}
|
||||
cancel()
|
||||
client := testpb.NewTestServiceClient(cc)
|
||||
defer cc.Close()
|
||||
|
||||
dlis.allowClose()
|
||||
|
||||
wcch := dlis.clientWriteCalledChan()
|
||||
go func() {
|
||||
// 5. Allow the client to read the GoAway. The RPC should complete
|
||||
// successfully.
|
||||
<-wcch
|
||||
dlis.allowClientRead()
|
||||
}()
|
||||
|
||||
// 4. Send an RPC on the new connection.
|
||||
// The server would send a GOAWAY first, but we are delaying the server's
|
||||
// writes for now until the client writes more than the preface.
|
||||
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||
if _, err := client.EmptyCall(ctx, &testpb.Empty{}); err != nil {
|
||||
t.Fatalf("EmptyCall() = %v; want <nil>", err)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
stream, err := client.FullDuplexCall(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("FullDuplexCall= _, %v; want _, <nil>", err)
|
||||
}
|
||||
go func() {
|
||||
// 5. Allow the client to read the GoAway. The RPC should complete
|
||||
// successfully.
|
||||
<-serverGotReq
|
||||
dlis.allowClientRead()
|
||||
}()
|
||||
if err := stream.Send(&testpb.StreamingOutputCallRequest{}); err != nil {
|
||||
t.Fatalf("stream.Send(_) = %v, want <nil>", err)
|
||||
}
|
||||
if _, err := stream.Recv(); err != nil {
|
||||
t.Fatalf("stream.Recv() = _, %v, want _, <nil>", err)
|
||||
}
|
||||
if _, err := stream.Recv(); err != io.EOF {
|
||||
t.Fatalf("stream.Recv() = _, %v, want _, io.EOF", err)
|
||||
}
|
||||
|
||||
// 5. happens above, then we finish the call.
|
||||
cancel()
|
||||
wg.Wait()
|
||||
|
355
vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go
generated
vendored
355
vendor/google.golang.org/grpc/test/grpc_testing/test.pb.go
generated
vendored
@ -1,23 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: grpc_testing/test.proto
|
||||
|
||||
/*
|
||||
Package grpc_testing is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
grpc_testing/test.proto
|
||||
|
||||
It has these top-level messages:
|
||||
Empty
|
||||
Payload
|
||||
SimpleRequest
|
||||
SimpleResponse
|
||||
StreamingInputCallRequest
|
||||
StreamingInputCallResponse
|
||||
ResponseParameters
|
||||
StreamingOutputCallRequest
|
||||
StreamingOutputCallResponse
|
||||
*/
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
@ -66,28 +49,74 @@ var PayloadType_value = map[string]int32{
|
||||
func (x PayloadType) String() string {
|
||||
return proto.EnumName(PayloadType_name, int32(x))
|
||||
}
|
||||
func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type Empty struct {
|
||||
func (PayloadType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{0}
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
type Empty struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Empty) Reset() { *m = Empty{} }
|
||||
func (m *Empty) String() string { return proto.CompactTextString(m) }
|
||||
func (*Empty) ProtoMessage() {}
|
||||
func (*Empty) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{0}
|
||||
}
|
||||
func (m *Empty) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Empty.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Empty.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Empty) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Empty.Merge(dst, src)
|
||||
}
|
||||
func (m *Empty) XXX_Size() int {
|
||||
return xxx_messageInfo_Empty.Size(m)
|
||||
}
|
||||
func (m *Empty) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Empty.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Empty proto.InternalMessageInfo
|
||||
|
||||
// A block of data, to simply increase gRPC message size.
|
||||
type Payload struct {
|
||||
// The type of data in body.
|
||||
Type PayloadType `protobuf:"varint,1,opt,name=type,enum=grpc.testing.PayloadType" json:"type,omitempty"`
|
||||
Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=grpc.testing.PayloadType" json:"type,omitempty"`
|
||||
// Primary contents of payload.
|
||||
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
|
||||
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
func (*Payload) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{1}
|
||||
}
|
||||
func (m *Payload) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Payload.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Payload.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Payload) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Payload.Merge(dst, src)
|
||||
}
|
||||
func (m *Payload) XXX_Size() int {
|
||||
return xxx_messageInfo_Payload.Size(m)
|
||||
}
|
||||
func (m *Payload) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Payload.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Payload proto.InternalMessageInfo
|
||||
|
||||
func (m *Payload) GetType() PayloadType {
|
||||
if m != nil {
|
||||
@ -107,22 +136,44 @@ func (m *Payload) GetBody() []byte {
|
||||
type SimpleRequest struct {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
// Desired payload size in the response from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize" json:"response_size,omitempty"`
|
||||
ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize,proto3" json:"response_size,omitempty"`
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"`
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
// Whether SimpleResponse should include username.
|
||||
FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername" json:"fill_username,omitempty"`
|
||||
FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername,proto3" json:"fill_username,omitempty"`
|
||||
// Whether SimpleResponse should include OAuth scope.
|
||||
FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope" json:"fill_oauth_scope,omitempty"`
|
||||
FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope,proto3" json:"fill_oauth_scope,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
func (*SimpleRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{2}
|
||||
}
|
||||
func (m *SimpleRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SimpleRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SimpleRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SimpleRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *SimpleRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SimpleRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *SimpleRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_SimpleRequest.Size(m)
|
||||
}
|
||||
func (m *SimpleRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SimpleRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SimpleRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *SimpleRequest) GetResponseType() PayloadType {
|
||||
if m != nil {
|
||||
@ -162,18 +213,40 @@ func (m *SimpleRequest) GetFillOauthScope() bool {
|
||||
// Unary response, as configured by the request.
|
||||
type SimpleResponse struct {
|
||||
// Payload to increase message size.
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
// The user the request came from, for verifying authentication was
|
||||
// successful when the client expected it.
|
||||
Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
|
||||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
// OAuth scope.
|
||||
OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope" json:"oauth_scope,omitempty"`
|
||||
OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
func (*SimpleResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{3}
|
||||
}
|
||||
func (m *SimpleResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_SimpleResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *SimpleResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_SimpleResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *SimpleResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_SimpleResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *SimpleResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_SimpleResponse.Size(m)
|
||||
}
|
||||
func (m *SimpleResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_SimpleResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_SimpleResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *SimpleResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -199,13 +272,35 @@ func (m *SimpleResponse) GetOauthScope() string {
|
||||
// Client-streaming request.
|
||||
type StreamingInputCallRequest struct {
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{4}
|
||||
}
|
||||
func (m *StreamingInputCallRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StreamingInputCallRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StreamingInputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StreamingInputCallRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *StreamingInputCallRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StreamingInputCallRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *StreamingInputCallRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_StreamingInputCallRequest.Size(m)
|
||||
}
|
||||
func (m *StreamingInputCallRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StreamingInputCallRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StreamingInputCallRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *StreamingInputCallRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -217,13 +312,35 @@ func (m *StreamingInputCallRequest) GetPayload() *Payload {
|
||||
// Client-streaming response.
|
||||
type StreamingInputCallResponse struct {
|
||||
// Aggregated size of payloads received from the client.
|
||||
AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize" json:"aggregated_payload_size,omitempty"`
|
||||
AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize,proto3" json:"aggregated_payload_size,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{5}
|
||||
}
|
||||
func (m *StreamingInputCallResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StreamingInputCallResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StreamingInputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StreamingInputCallResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *StreamingInputCallResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StreamingInputCallResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *StreamingInputCallResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_StreamingInputCallResponse.Size(m)
|
||||
}
|
||||
func (m *StreamingInputCallResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StreamingInputCallResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StreamingInputCallResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 {
|
||||
if m != nil {
|
||||
@ -236,16 +353,38 @@ func (m *StreamingInputCallResponse) GetAggregatedPayloadSize() int32 {
|
||||
type ResponseParameters struct {
|
||||
// Desired payload sizes in responses from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
Size int32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
|
||||
Size int32 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"`
|
||||
// Desired interval between consecutive responses in the response stream in
|
||||
// microseconds.
|
||||
IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs" json:"interval_us,omitempty"`
|
||||
IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs,proto3" json:"interval_us,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
func (*ResponseParameters) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{6}
|
||||
}
|
||||
func (m *ResponseParameters) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_ResponseParameters.Unmarshal(m, b)
|
||||
}
|
||||
func (m *ResponseParameters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_ResponseParameters.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *ResponseParameters) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_ResponseParameters.Merge(dst, src)
|
||||
}
|
||||
func (m *ResponseParameters) XXX_Size() int {
|
||||
return xxx_messageInfo_ResponseParameters.Size(m)
|
||||
}
|
||||
func (m *ResponseParameters) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_ResponseParameters.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_ResponseParameters proto.InternalMessageInfo
|
||||
|
||||
func (m *ResponseParameters) GetSize() int32 {
|
||||
if m != nil {
|
||||
@ -267,17 +406,39 @@ type StreamingOutputCallRequest struct {
|
||||
// If response_type is RANDOM, the payload from each response in the stream
|
||||
// might be of different types. This is to simulate a mixed type of payload
|
||||
// stream.
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,proto3,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
// Configuration for each expected response message.
|
||||
ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters" json:"response_parameters,omitempty"`
|
||||
ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters,proto3" json:"response_parameters,omitempty"`
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"`
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{7}
|
||||
}
|
||||
func (m *StreamingOutputCallRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StreamingOutputCallRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StreamingOutputCallRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StreamingOutputCallRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *StreamingOutputCallRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StreamingOutputCallRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *StreamingOutputCallRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_StreamingOutputCallRequest.Size(m)
|
||||
}
|
||||
func (m *StreamingOutputCallRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StreamingOutputCallRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StreamingOutputCallRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *StreamingOutputCallRequest) GetResponseType() PayloadType {
|
||||
if m != nil {
|
||||
@ -303,13 +464,35 @@ func (m *StreamingOutputCallRequest) GetPayload() *Payload {
|
||||
// Server-streaming response, as configured by the request and parameters.
|
||||
type StreamingOutputCallResponse struct {
|
||||
// Payload to increase response size.
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_test_c9f6c5af4267cb88, []int{8}
|
||||
}
|
||||
func (m *StreamingOutputCallResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_StreamingOutputCallResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *StreamingOutputCallResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_StreamingOutputCallResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *StreamingOutputCallResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_StreamingOutputCallResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *StreamingOutputCallResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_StreamingOutputCallResponse.Size(m)
|
||||
}
|
||||
func (m *StreamingOutputCallResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_StreamingOutputCallResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_StreamingOutputCallResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *StreamingOutputCallResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
@ -339,8 +522,9 @@ var _ grpc.ClientConn
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for TestService service
|
||||
|
||||
// TestServiceClient is the client API for TestService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type TestServiceClient interface {
|
||||
// One empty request followed by one empty response.
|
||||
EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error)
|
||||
@ -374,7 +558,7 @@ func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient {
|
||||
|
||||
func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*Empty, error) {
|
||||
out := new(Empty)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, c.cc, opts...)
|
||||
err := c.cc.Invoke(ctx, "/grpc.testing.TestService/EmptyCall", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -383,7 +567,7 @@ func (c *testServiceClient) EmptyCall(ctx context.Context, in *Empty, opts ...gr
|
||||
|
||||
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
||||
out := new(SimpleResponse)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...)
|
||||
err := c.cc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -391,7 +575,7 @@ func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, op
|
||||
}
|
||||
|
||||
func (c *testServiceClient) StreamingOutputCall(ctx context.Context, in *StreamingOutputCallRequest, opts ...grpc.CallOption) (TestService_StreamingOutputCallClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/grpc.testing.TestService/StreamingOutputCall", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[0], "/grpc.testing.TestService/StreamingOutputCall", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -423,7 +607,7 @@ func (x *testServiceStreamingOutputCallClient) Recv() (*StreamingOutputCallRespo
|
||||
}
|
||||
|
||||
func (c *testServiceClient) StreamingInputCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingInputCallClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[1], c.cc, "/grpc.testing.TestService/StreamingInputCall", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[1], "/grpc.testing.TestService/StreamingInputCall", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -457,7 +641,7 @@ func (x *testServiceStreamingInputCallClient) CloseAndRecv() (*StreamingInputCal
|
||||
}
|
||||
|
||||
func (c *testServiceClient) FullDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_FullDuplexCallClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[2], c.cc, "/grpc.testing.TestService/FullDuplexCall", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[2], "/grpc.testing.TestService/FullDuplexCall", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -488,7 +672,7 @@ func (x *testServiceFullDuplexCallClient) Recv() (*StreamingOutputCallResponse,
|
||||
}
|
||||
|
||||
func (c *testServiceClient) HalfDuplexCall(ctx context.Context, opts ...grpc.CallOption) (TestService_HalfDuplexCallClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[3], c.cc, "/grpc.testing.TestService/HalfDuplexCall", opts...)
|
||||
stream, err := c.cc.NewStream(ctx, &_TestService_serviceDesc.Streams[3], "/grpc.testing.TestService/HalfDuplexCall", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -518,8 +702,7 @@ func (x *testServiceHalfDuplexCallClient) Recv() (*StreamingOutputCallResponse,
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for TestService service
|
||||
|
||||
// TestServiceServer is the server API for TestService service.
|
||||
type TestServiceServer interface {
|
||||
// One empty request followed by one empty response.
|
||||
EmptyCall(context.Context, *Empty) (*Empty, error)
|
||||
@ -722,9 +905,9 @@ var _TestService_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "grpc_testing/test.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor0) }
|
||||
func init() { proto.RegisterFile("grpc_testing/test.proto", fileDescriptor_test_c9f6c5af4267cb88) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
var fileDescriptor_test_c9f6c5af4267cb88 = []byte{
|
||||
// 587 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x55, 0xdb, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0x65, 0xdb, 0xf4, 0x36, 0x49, 0xad, 0x68, 0xab, 0xaa, 0xae, 0x8b, 0x84, 0x65, 0x1e, 0x30,
|
||||
|
118
vendor/google.golang.org/grpc/test/leakcheck/leakcheck.go
generated
vendored
118
vendor/google.golang.org/grpc/test/leakcheck/leakcheck.go
generated
vendored
@ -1,118 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
// Package leakcheck contains functions to check leaked goroutines.
|
||||
//
|
||||
// Call "defer leakcheck.Check(t)" at the beginning of tests.
|
||||
package leakcheck
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
var goroutinesToIgnore = []string{
|
||||
"testing.Main(",
|
||||
"testing.tRunner(",
|
||||
"testing.(*M).",
|
||||
"runtime.goexit",
|
||||
"created by runtime.gc",
|
||||
"created by runtime/trace.Start",
|
||||
"interestingGoroutines",
|
||||
"runtime.MHeap_Scavenger",
|
||||
"signal.signal_recv",
|
||||
"sigterm.handler",
|
||||
"runtime_mcall",
|
||||
"(*loggingT).flushDaemon",
|
||||
"goroutine in C code",
|
||||
}
|
||||
|
||||
// RegisterIgnoreGoroutine appends s into the ignore goroutine list. The
|
||||
// goroutines whose stack trace contains s will not be identified as leaked
|
||||
// goroutines. Not thread-safe, only call this function in init().
|
||||
func RegisterIgnoreGoroutine(s string) {
|
||||
goroutinesToIgnore = append(goroutinesToIgnore, s)
|
||||
}
|
||||
|
||||
func ignore(g string) bool {
|
||||
sl := strings.SplitN(g, "\n", 2)
|
||||
if len(sl) != 2 {
|
||||
return true
|
||||
}
|
||||
stack := strings.TrimSpace(sl[1])
|
||||
if strings.HasPrefix(stack, "testing.RunTests") {
|
||||
return true
|
||||
}
|
||||
|
||||
if stack == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, s := range goroutinesToIgnore {
|
||||
if strings.Contains(stack, s) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// interestingGoroutines returns all goroutines we care about for the purpose of
|
||||
// leak checking. It excludes testing or runtime ones.
|
||||
func interestingGoroutines() (gs []string) {
|
||||
buf := make([]byte, 2<<20)
|
||||
buf = buf[:runtime.Stack(buf, true)]
|
||||
for _, g := range strings.Split(string(buf), "\n\n") {
|
||||
if !ignore(g) {
|
||||
gs = append(gs, g)
|
||||
}
|
||||
}
|
||||
sort.Strings(gs)
|
||||
return
|
||||
}
|
||||
|
||||
// Errorfer is the interface that wraps the Errorf method. It's a subset of
|
||||
// testing.TB to make it easy to use Check.
|
||||
type Errorfer interface {
|
||||
Errorf(format string, args ...interface{})
|
||||
}
|
||||
|
||||
func check(efer Errorfer, timeout time.Duration) {
|
||||
// Loop, waiting for goroutines to shut down.
|
||||
// Wait up to timeout, but finish as quickly as possible.
|
||||
deadline := time.Now().Add(timeout)
|
||||
var leaked []string
|
||||
for time.Now().Before(deadline) {
|
||||
if leaked = interestingGoroutines(); len(leaked) == 0 {
|
||||
return
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
}
|
||||
for _, g := range leaked {
|
||||
efer.Errorf("Leaked goroutine: %v", g)
|
||||
}
|
||||
}
|
||||
|
||||
// Check looks at the currently-running goroutines and checks if there are any
|
||||
// interestring (created by gRPC) goroutines leaked. It waits up to 10 seconds
|
||||
// in the error cases.
|
||||
func Check(efer Errorfer) {
|
||||
check(efer, 10*time.Second)
|
||||
}
|
76
vendor/google.golang.org/grpc/test/leakcheck/leakcheck_test.go
generated
vendored
76
vendor/google.golang.org/grpc/test/leakcheck/leakcheck_test.go
generated
vendored
@ -1,76 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2017 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package leakcheck
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
type testErrorfer struct {
|
||||
errorCount int
|
||||
errors []string
|
||||
}
|
||||
|
||||
func (e *testErrorfer) Errorf(format string, args ...interface{}) {
|
||||
e.errors = append(e.errors, fmt.Sprintf(format, args...))
|
||||
e.errorCount++
|
||||
}
|
||||
|
||||
func TestCheck(t *testing.T) {
|
||||
const leakCount = 3
|
||||
for i := 0; i < leakCount; i++ {
|
||||
go func() { time.Sleep(2 * time.Second) }()
|
||||
}
|
||||
if ig := interestingGoroutines(); len(ig) == 0 {
|
||||
t.Error("blah")
|
||||
}
|
||||
e := &testErrorfer{}
|
||||
check(e, time.Second)
|
||||
if e.errorCount != leakCount {
|
||||
t.Errorf("check found %v leaks, want %v leaks", e.errorCount, leakCount)
|
||||
t.Logf("leaked goroutines:\n%v", strings.Join(e.errors, "\n"))
|
||||
}
|
||||
check(t, 3*time.Second)
|
||||
}
|
||||
|
||||
func ignoredTestingLeak(d time.Duration) {
|
||||
time.Sleep(d)
|
||||
}
|
||||
|
||||
func TestCheckRegisterIgnore(t *testing.T) {
|
||||
RegisterIgnoreGoroutine("ignoredTestingLeak")
|
||||
const leakCount = 3
|
||||
for i := 0; i < leakCount; i++ {
|
||||
go func() { time.Sleep(2 * time.Second) }()
|
||||
}
|
||||
go func() { ignoredTestingLeak(3 * time.Second) }()
|
||||
if ig := interestingGoroutines(); len(ig) == 0 {
|
||||
t.Error("blah")
|
||||
}
|
||||
e := &testErrorfer{}
|
||||
check(e, time.Second)
|
||||
if e.errorCount != leakCount {
|
||||
t.Errorf("check found %v leaks, want %v leaks", e.errorCount, leakCount)
|
||||
t.Logf("leaked goroutines:\n%v", strings.Join(e.errors, "\n"))
|
||||
}
|
||||
check(t, 3*time.Second)
|
||||
}
|
345
vendor/google.golang.org/grpc/test/rawConnWrapper.go
generated
vendored
Normal file
345
vendor/google.golang.org/grpc/test/rawConnWrapper.go
generated
vendored
Normal file
@ -0,0 +1,345 @@
|
||||
/*
|
||||
* Copyright 2018 gRPC authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/hpack"
|
||||
)
|
||||
|
||||
type listenerWrapper struct {
|
||||
net.Listener
|
||||
mu sync.Mutex
|
||||
rcw *rawConnWrapper
|
||||
}
|
||||
|
||||
func listenWithConnControl(network, address string) (net.Listener, error) {
|
||||
l, err := net.Listen(network, address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &listenerWrapper{Listener: l}, nil
|
||||
}
|
||||
|
||||
// Accept blocks until Dial is called, then returns a net.Conn for the server
|
||||
// half of the connection.
|
||||
func (l *listenerWrapper) Accept() (net.Conn, error) {
|
||||
c, err := l.Listener.Accept()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
l.mu.Lock()
|
||||
l.rcw = newRawConnWrapperFromConn(c)
|
||||
l.mu.Unlock()
|
||||
return c, nil
|
||||
}
|
||||
|
||||
func (l *listenerWrapper) getLastConn() *rawConnWrapper {
|
||||
l.mu.Lock()
|
||||
defer l.mu.Unlock()
|
||||
return l.rcw
|
||||
}
|
||||
|
||||
type dialerWrapper struct {
|
||||
c net.Conn
|
||||
rcw *rawConnWrapper
|
||||
}
|
||||
|
||||
func (d *dialerWrapper) dialer(target string, t time.Duration) (net.Conn, error) {
|
||||
c, err := net.DialTimeout("tcp", target, t)
|
||||
d.c = c
|
||||
d.rcw = newRawConnWrapperFromConn(c)
|
||||
return c, err
|
||||
}
|
||||
|
||||
func (d *dialerWrapper) getRawConnWrapper() *rawConnWrapper {
|
||||
return d.rcw
|
||||
}
|
||||
|
||||
type rawConnWrapper struct {
|
||||
cc io.ReadWriteCloser
|
||||
fr *http2.Framer
|
||||
|
||||
// writing headers:
|
||||
headerBuf bytes.Buffer
|
||||
hpackEnc *hpack.Encoder
|
||||
|
||||
// reading frames:
|
||||
frc chan http2.Frame
|
||||
frErrc chan error
|
||||
readTimer *time.Timer
|
||||
}
|
||||
|
||||
func newRawConnWrapperFromConn(cc io.ReadWriteCloser) *rawConnWrapper {
|
||||
rcw := &rawConnWrapper{
|
||||
cc: cc,
|
||||
frc: make(chan http2.Frame, 1),
|
||||
frErrc: make(chan error, 1),
|
||||
}
|
||||
rcw.hpackEnc = hpack.NewEncoder(&rcw.headerBuf)
|
||||
rcw.fr = http2.NewFramer(cc, cc)
|
||||
rcw.fr.ReadMetaHeaders = hpack.NewDecoder(4096 /*initialHeaderTableSize*/, nil)
|
||||
|
||||
return rcw
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) Close() error {
|
||||
return rcw.cc.Close()
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) readFrame() (http2.Frame, error) {
|
||||
go func() {
|
||||
fr, err := rcw.fr.ReadFrame()
|
||||
if err != nil {
|
||||
rcw.frErrc <- err
|
||||
} else {
|
||||
rcw.frc <- fr
|
||||
}
|
||||
}()
|
||||
t := time.NewTimer(2 * time.Second)
|
||||
defer t.Stop()
|
||||
select {
|
||||
case f := <-rcw.frc:
|
||||
return f, nil
|
||||
case err := <-rcw.frErrc:
|
||||
return nil, err
|
||||
case <-t.C:
|
||||
return nil, fmt.Errorf("timeout waiting for frame")
|
||||
}
|
||||
}
|
||||
|
||||
// greet initiates the client's HTTP/2 connection into a state where
|
||||
// frames may be sent.
|
||||
func (rcw *rawConnWrapper) greet() error {
|
||||
rcw.writePreface()
|
||||
rcw.writeInitialSettings()
|
||||
rcw.wantSettings()
|
||||
rcw.writeSettingsAck()
|
||||
for {
|
||||
f, err := rcw.readFrame()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
switch f := f.(type) {
|
||||
case *http2.WindowUpdateFrame:
|
||||
// grpc's transport/http2_server sends this
|
||||
// before the settings ack. The Go http2
|
||||
// server uses a setting instead.
|
||||
case *http2.SettingsFrame:
|
||||
if f.IsAck() {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("during greet, got non-ACK settings frame")
|
||||
default:
|
||||
return fmt.Errorf("during greet, unexpected frame type %T", f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writePreface() error {
|
||||
n, err := rcw.cc.Write([]byte(http2.ClientPreface))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error writing client preface: %v", err)
|
||||
}
|
||||
if n != len(http2.ClientPreface) {
|
||||
return fmt.Errorf("Writing client preface, wrote %d bytes; want %d", n, len(http2.ClientPreface))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeInitialSettings() error {
|
||||
if err := rcw.fr.WriteSettings(); err != nil {
|
||||
return fmt.Errorf("Error writing initial SETTINGS frame from client to server: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeSettingsAck() error {
|
||||
if err := rcw.fr.WriteSettingsAck(); err != nil {
|
||||
return fmt.Errorf("Error writing ACK of server's SETTINGS: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) wantSettings() (*http2.SettingsFrame, error) {
|
||||
f, err := rcw.readFrame()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error while expecting a SETTINGS frame: %v", err)
|
||||
}
|
||||
sf, ok := f.(*http2.SettingsFrame)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("got a %T; want *SettingsFrame", f)
|
||||
}
|
||||
return sf, nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) wantSettingsAck() error {
|
||||
f, err := rcw.readFrame()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sf, ok := f.(*http2.SettingsFrame)
|
||||
if !ok {
|
||||
return fmt.Errorf("Wanting a settings ACK, received a %T", f)
|
||||
}
|
||||
if !sf.IsAck() {
|
||||
return fmt.Errorf("Settings Frame didn't have ACK set")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// wait for any activity from the server
|
||||
func (rcw *rawConnWrapper) wantAnyFrame() (http2.Frame, error) {
|
||||
f, err := rcw.fr.ReadFrame()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) encodeHeaderField(k, v string) error {
|
||||
err := rcw.hpackEnc.WriteField(hpack.HeaderField{Name: k, Value: v})
|
||||
if err != nil {
|
||||
return fmt.Errorf("HPACK encoding error for %q/%q: %v", k, v, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// encodeHeader encodes headers and returns their HPACK bytes. headers
|
||||
// must contain an even number of key/value pairs. There may be
|
||||
// multiple pairs for keys (e.g. "cookie"). The :method, :path, and
|
||||
// :scheme headers default to GET, / and https.
|
||||
func (rcw *rawConnWrapper) encodeHeader(headers ...string) []byte {
|
||||
if len(headers)%2 == 1 {
|
||||
panic("odd number of kv args")
|
||||
}
|
||||
|
||||
rcw.headerBuf.Reset()
|
||||
|
||||
if len(headers) == 0 {
|
||||
// Fast path, mostly for benchmarks, so test code doesn't pollute
|
||||
// profiles when we're looking to improve server allocations.
|
||||
rcw.encodeHeaderField(":method", "GET")
|
||||
rcw.encodeHeaderField(":path", "/")
|
||||
rcw.encodeHeaderField(":scheme", "https")
|
||||
return rcw.headerBuf.Bytes()
|
||||
}
|
||||
|
||||
if len(headers) == 2 && headers[0] == ":method" {
|
||||
// Another fast path for benchmarks.
|
||||
rcw.encodeHeaderField(":method", headers[1])
|
||||
rcw.encodeHeaderField(":path", "/")
|
||||
rcw.encodeHeaderField(":scheme", "https")
|
||||
return rcw.headerBuf.Bytes()
|
||||
}
|
||||
|
||||
pseudoCount := map[string]int{}
|
||||
keys := []string{":method", ":path", ":scheme"}
|
||||
vals := map[string][]string{
|
||||
":method": {"GET"},
|
||||
":path": {"/"},
|
||||
":scheme": {"https"},
|
||||
}
|
||||
for len(headers) > 0 {
|
||||
k, v := headers[0], headers[1]
|
||||
headers = headers[2:]
|
||||
if _, ok := vals[k]; !ok {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
if strings.HasPrefix(k, ":") {
|
||||
pseudoCount[k]++
|
||||
if pseudoCount[k] == 1 {
|
||||
vals[k] = []string{v}
|
||||
} else {
|
||||
// Allows testing of invalid headers w/ dup pseudo fields.
|
||||
vals[k] = append(vals[k], v)
|
||||
}
|
||||
} else {
|
||||
vals[k] = append(vals[k], v)
|
||||
}
|
||||
}
|
||||
for _, k := range keys {
|
||||
for _, v := range vals[k] {
|
||||
rcw.encodeHeaderField(k, v)
|
||||
}
|
||||
}
|
||||
return rcw.headerBuf.Bytes()
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeHeadersGRPC(streamID uint32, path string) {
|
||||
rcw.writeHeaders(http2.HeadersFrameParam{
|
||||
StreamID: streamID,
|
||||
BlockFragment: rcw.encodeHeader(
|
||||
":method", "POST",
|
||||
":path", path,
|
||||
"content-type", "application/grpc",
|
||||
"te", "trailers",
|
||||
),
|
||||
EndStream: false,
|
||||
EndHeaders: true,
|
||||
})
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeHeaders(p http2.HeadersFrameParam) error {
|
||||
if err := rcw.fr.WriteHeaders(p); err != nil {
|
||||
return fmt.Errorf("Error writing HEADERS: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeData(streamID uint32, endStream bool, data []byte) error {
|
||||
if err := rcw.fr.WriteData(streamID, endStream, data); err != nil {
|
||||
return fmt.Errorf("Error writing DATA: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeRSTStream(streamID uint32, code http2.ErrCode) error {
|
||||
if err := rcw.fr.WriteRSTStream(streamID, code); err != nil {
|
||||
return fmt.Errorf("Error writing RST_STREAM: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeDataPadded(streamID uint32, endStream bool, data, padding []byte) error {
|
||||
if err := rcw.fr.WriteDataPadded(streamID, endStream, data, padding); err != nil {
|
||||
return fmt.Errorf("Error writing DATA with padding: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeGoAway(maxStreamID uint32, code http2.ErrCode, debugData []byte) error {
|
||||
if err := rcw.fr.WriteGoAway(maxStreamID, code, debugData); err != nil {
|
||||
return fmt.Errorf("Error writing GoAway: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rcw *rawConnWrapper) writeRawFrame(t http2.FrameType, flags http2.Flags, streamID uint32, payload []byte) error {
|
||||
if err := rcw.fr.WriteRawFrame(t, flags, streamID, payload); err != nil {
|
||||
return fmt.Errorf("Error writing Raw Frame: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user