mirror of https://github.com/grpc/grpc-go.git
add the missing close(s.done)
This commit is contained in:
parent
55b7bd0424
commit
1ea428008b
7
call.go
7
call.go
|
|
@ -86,11 +86,14 @@ func sendRequest(ctx context.Context, codec Codec, compressor Compressor, callHd
|
|||
cbuf = new(bytes.Buffer)
|
||||
}
|
||||
outBuf, err := encode(codec, args, compressor, cbuf)
|
||||
if err != nil && err != io.EOF {
|
||||
if err != nil {
|
||||
return nil, transport.StreamErrorf(codes.Internal, "grpc: %v", err)
|
||||
}
|
||||
err = t.Write(stream, outBuf, opts)
|
||||
if err != nil {
|
||||
// t.NewStream(...) could lead to an early rejection of the RPC (e.g., the service/method
|
||||
// does not exist.) so that t.Write could get io.EOF from wait(...). Leave the following
|
||||
// recvResponse to get the final status.
|
||||
if err != nil && err != io.EOF {
|
||||
return nil, err
|
||||
}
|
||||
// Sent successfully.
|
||||
|
|
|
|||
|
|
@ -558,10 +558,7 @@ func testTimeoutOnDeadServer(t *testing.T, e env) {
|
|||
t.Fatalf("TestService/EmptyCall(_, _) = _, %v, want _, <nil>", err)
|
||||
}
|
||||
te.srv.Stop()
|
||||
// Set -1 as the timeout to make sure if transportMonitor gets error
|
||||
// notification in time the failure path of the 1st invoke of
|
||||
// ClientConn.wait hits the deadline exceeded error.
|
||||
ctx, _ := context.WithTimeout(context.Background(), -1)
|
||||
ctx, _ := context.WithTimeout(context.Background(), time.Millisecond)
|
||||
if _, err := tc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); grpc.Code(err) != codes.DeadlineExceeded {
|
||||
t.Fatalf("TestService/EmptyCall(%v, _) = _, %v, want _, error code: %d", ctx, err, codes.DeadlineExceeded)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue