X Tutup
Skip to content

Commit 2ed8e60

Browse files
committed
bump google.golang.org/grpc v1.20.1
full diff: grpc/grpc-go@v1.12.2...v1.20.1 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent d1c5951 commit 2ed8e60

File tree

98 files changed

+8083
-5231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+8083
-5231
lines changed

client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func New(address string, opts ...ClientOpt) (*Client, error) {
102102
grpc.WithInsecure(),
103103
grpc.FailOnNonTempDialError(true),
104104
grpc.WithBackoffMaxDelay(3 * time.Second),
105-
grpc.WithDialer(dialer.Dialer),
105+
grpc.WithContextDialer(dialer.ContextDialer),
106106

107107
// TODO(stevvooe): We may need to allow configuration of this on the client.
108108
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),
@@ -225,7 +225,7 @@ func (c *Client) IsServing(ctx context.Context) (bool, error) {
225225
return false, errors.New("no grpc connection available")
226226
}
227227
c.connMu.Unlock()
228-
r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.FailFast(false))
228+
r, err := c.HealthService().Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.WaitForReady(true))
229229
if err != nil {
230230
return false, err
231231
}

cmd/containerd/command/publish.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,18 @@ func getEventPayload(r io.Reader) (*types.Any, error) {
8484
}
8585

8686
func connectEvents(address string) (eventsapi.EventsClient, error) {
87-
conn, err := connect(address, dialer.Dialer)
87+
conn, err := connect(address, dialer.ContextDialer)
8888
if err != nil {
8989
return nil, errors.Wrapf(err, "failed to dial %q", address)
9090
}
9191
return eventsapi.NewEventsClient(conn), nil
9292
}
9393

94-
func connect(address string, d func(string, time.Duration) (net.Conn, error)) (*grpc.ClientConn, error) {
94+
func connect(address string, d func(gocontext.Context, string) (net.Conn, error)) (*grpc.ClientConn, error) {
9595
gopts := []grpc.DialOption{
9696
grpc.WithBlock(),
9797
grpc.WithInsecure(),
98-
grpc.WithDialer(d),
98+
grpc.WithContextDialer(d),
9999
grpc.FailOnNonTempDialError(true),
100100
grpc.WithBackoffMaxDelay(3 * time.Second),
101101
}

pkg/dialer/dialer.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package dialer
1818

1919
import (
20+
"context"
2021
"net"
2122
"time"
2223

@@ -28,8 +29,19 @@ type dialResult struct {
2829
err error
2930
}
3031

32+
// ContextDialer returns a GRPC net.Conn connected to the provided address
33+
func ContextDialer(ctx context.Context, address string) (net.Conn, error) {
34+
if deadline, ok := ctx.Deadline(); ok {
35+
return timeoutDialer(address, time.Until(deadline))
36+
}
37+
return timeoutDialer(address, 0)
38+
}
39+
3140
// Dialer returns a GRPC net.Conn connected to the provided address
32-
func Dialer(address string, timeout time.Duration) (net.Conn, error) {
41+
// Deprecated: use ContextDialer and grpc.WithContextDialer.
42+
var Dialer = timeoutDialer
43+
44+
func timeoutDialer(address string, timeout time.Duration) (net.Conn, error) {
3345
var (
3446
stopC = make(chan struct{})
3547
synC = make(chan *dialResult)

services/server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ func (pc *proxyClients) getClient(address string) (*grpc.ClientConn, error) {
436436
gopts := []grpc.DialOption{
437437
grpc.WithInsecure(),
438438
grpc.WithBackoffMaxDelay(3 * time.Second),
439-
grpc.WithDialer(dialer.Dialer),
439+
grpc.WithContextDialer(dialer.ContextDialer),
440440

441441
// TODO(stevvooe): We may need to allow configuration of this on the client.
442442
grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(defaults.DefaultMaxRecvMsgSize)),

vendor.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1
2525
github.com/sirupsen/logrus v1.4.1
2626
github.com/urfave/cli 7bc6a0acffa589f415f88aca16cc1de5ffd66f9c
2727
golang.org/x/net b3756b4b77d7b13260a0a2ec658753cf48922eac
28-
google.golang.org/grpc v1.12.2
28+
google.golang.org/grpc 25c4f928eaa6d96443009bd842389fb4fa48664e # v1.20.1
2929
github.com/pkg/errors v0.8.1
3030
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
3131
golang.org/x/sys d455e41777fca6e8a5a79e34a14b8368bc11d9ba https://github.com/golang/sys

vendor/google.golang.org/grpc/README.md

Lines changed: 24 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/google.golang.org/grpc/backoff.go

Lines changed: 4 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/google.golang.org/grpc/balancer.go

Lines changed: 1 addition & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
X Tutup