From 10365b5941e7a4ca278c5e91a337b930a7670390 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Thu, 22 Nov 2018 22:31:37 +0000 Subject: [PATCH] Update id/auth client --- vendor/git.autistici.org/id/auth/client/client.go | 9 ++++++++- vendor/vendor.json | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/vendor/git.autistici.org/id/auth/client/client.go b/vendor/git.autistici.org/id/auth/client/client.go index 81f434a..245a402 100644 --- a/vendor/git.autistici.org/id/auth/client/client.go +++ b/vendor/git.autistici.org/id/auth/client/client.go @@ -28,14 +28,21 @@ func New(socketPath string) Client { } func (c *socketClient) Authenticate(ctx context.Context, req *auth.Request) (*auth.Response, error) { + // Create the connection outside of the timed goroutine, so + // that we can call Close() on exit regardless of the reason: + // this way, when a timeout occurs or the context is canceled, + // the pending request terminates immediately. conn, err := textproto.Dial("unix", c.socketPath) if err != nil { return nil, err } defer conn.Close() + // Make space in the channel for at least one element, or we + // will leak a goroutine whenever the authentication request + // times out. + done := make(chan error, 1) var resp auth.Response - done := make(chan error) go func() { defer close(done) diff --git a/vendor/vendor.json b/vendor/vendor.json index 0a5653c..a62ab61 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -29,14 +29,14 @@ { "checksumSHA1": "6D5Xt9WoGSeTJE3XFw6P2/nKYrQ=", "path": "git.autistici.org/id/auth", - "revision": "d5da26d7565082baa108a1c1806f2fc723d33ccb", - "revisionTime": "2018-11-18T17:43:45Z" + "revision": "1276ec2bd95945ea45a8680a15b76cad8a339096", + "revisionTime": "2018-11-22T22:30:45Z" }, { - "checksumSHA1": "48njEQBB73cV6tTPBEOnzSVRjeA=", + "checksumSHA1": "t3JTZ0bAMQit79HYbcEykC8uxro=", "path": "git.autistici.org/id/auth/client", - "revision": "d5da26d7565082baa108a1c1806f2fc723d33ccb", - "revisionTime": "2018-11-18T17:43:45Z" + "revision": "1276ec2bd95945ea45a8680a15b76cad8a339096", + "revisionTime": "2018-11-22T22:30:45Z" }, { "checksumSHA1": "MlpsZgRytv/c9IX9YawRJDN/ibQ=", -- GitLab