From d2ecee80c0d4f9db446bdca755693282c6a75bf3 Mon Sep 17 00:00:00 2001 From: renovate <renovate-bot@autistici.org> Date: Tue, 5 Sep 2023 03:31:15 +0000 Subject: [PATCH] Update github.com/bradfitz/gomemcache digest to 24af94b --- go.mod | 2 +- go.sum | 2 + vendor/github.com/bradfitz/gomemcache/AUTHORS | 9 +++++ .../bradfitz/gomemcache/memcache/memcache.go | 38 +++++++++++++++---- .../bradfitz/gomemcache/memcache/selector.go | 2 +- vendor/modules.txt | 2 +- 6 files changed, 44 insertions(+), 11 deletions(-) create mode 100644 vendor/github.com/bradfitz/gomemcache/AUTHORS diff --git a/go.mod b/go.mod index bd6473b4..9cadb124 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( cloud.google.com/go v0.88.0 // indirect git.autistici.org/ai3/go-common v0.0.0-20230816213645-b3aa3fb514d6 git.autistici.org/id/usermetadb v0.0.0-20230817075814-ec109f54aa90 - github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746 + github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 github.com/cenkalti/backoff/v4 v4.1.3 github.com/coreos/go-systemd/v22 v22.5.0 github.com/duo-labs/webauthn v0.0.0-20220330035159-03696f3d4499 diff --git a/go.sum b/go.sum index b4e2fdc0..60816012 100644 --- a/go.sum +++ b/go.sum @@ -165,6 +165,8 @@ github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822 h1:hjXJeBcAMS1 github.com/bradfitz/gomemcache v0.0.0-20221031212613-62deef7fc822/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746 h1:wAIE/kN63Oig1DdOzN7O+k4AbFh2cCJoKMFXrwRJtzk= github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= +github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 h1:N7oVaKyGp8bttX0bfZGmcGkjz7DLQXhAn3DNd3T0ous= +github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874/go.mod h1:r5xuitiExdLAJ09PR7vBVENGvp4ZuTBeWTGtxuX3K+c= github.com/caarlos0/ctrlc v1.0.0/go.mod h1:CdXpj4rmq0q/1Eb44M9zi2nKB0QraNKuRGYGrrHhcQw= github.com/campoy/unique v0.0.0-20180121183637-88950e537e7e/go.mod h1:9IOqJGCPMSc6E5ydlp5NIonxObaeu/Iub/X03EKPVYo= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= diff --git a/vendor/github.com/bradfitz/gomemcache/AUTHORS b/vendor/github.com/bradfitz/gomemcache/AUTHORS new file mode 100644 index 00000000..86ca6207 --- /dev/null +++ b/vendor/github.com/bradfitz/gomemcache/AUTHORS @@ -0,0 +1,9 @@ +The following people & companies are the copyright holders of this +package. Feel free to add to this list if you or your employer cares, +otherwise it's implicit from the git log. + +Authors: + +- Brad Fitzpatrick +- Google, Inc. (from Googlers contributing) +- Anybody else in the git log. diff --git a/vendor/github.com/bradfitz/gomemcache/memcache/memcache.go b/vendor/github.com/bradfitz/gomemcache/memcache/memcache.go index b536d384..b2ebacd2 100644 --- a/vendor/github.com/bradfitz/gomemcache/memcache/memcache.go +++ b/vendor/github.com/bradfitz/gomemcache/memcache/memcache.go @@ -1,5 +1,5 @@ /* -Copyright 2011 Google Inc. +Copyright 2011 The gomemcache AUTHORS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,11 +20,11 @@ package memcache import ( "bufio" "bytes" + "context" "errors" "fmt" "io" "net" - "strconv" "strings" "sync" @@ -65,7 +65,7 @@ var ( const ( // DefaultTimeout is the default socket read/write timeout. - DefaultTimeout = 100 * time.Millisecond + DefaultTimeout = 500 * time.Millisecond // DefaultMaxIdleConns is the default maximum number of idle connections // kept for any single address. @@ -132,6 +132,14 @@ func NewFromSelector(ss ServerSelector) *Client { // Client is a memcache client. // It is safe for unlocked use by multiple concurrent goroutines. type Client struct { + // DialContext connects to the address on the named network using the + // provided context. + // + // To connect to servers using TLS (memcached running with "--enable-ssl"), + // use a DialContext func that uses tls.Dialer.DialContext. See this + // package's tests as an example. + DialContext func(ctx context.Context, network, address string) (net.Conn, error) + // Timeout specifies the socket read/write timeout. // If zero, DefaultTimeout is used. Timeout time.Duration @@ -167,8 +175,11 @@ type Item struct { // Zero means the Item has no expiration time. Expiration int32 - // Compare and swap ID. - casid uint64 + // CasID is the compare and swap ID. + // + // It's populated by get requests and then the same value is + // required for a CompareAndSwap request to succeed. + CasID uint64 } // conn is a connection to a server. @@ -255,7 +266,18 @@ func (cte *ConnectTimeoutError) Error() string { } func (c *Client) dial(addr net.Addr) (net.Conn, error) { - nc, err := net.DialTimeout(addr.Network(), addr.String(), c.netTimeout()) + ctx, cancel := context.WithTimeout(context.Background(), c.netTimeout()) + defer cancel() + + dialerContext := c.DialContext + if dialerContext == nil { + dialer := net.Dialer{ + Timeout: c.netTimeout(), + } + dialerContext = dialer.DialContext + } + + nc, err := dialerContext(ctx, addr.Network(), addr.String()) if err == nil { return nc, nil } @@ -520,7 +542,7 @@ func parseGetResponse(r *bufio.Reader, cb func(*Item)) error { // It does not read the bytes of the item. func scanGetResponseLine(line []byte, it *Item) (size int, err error) { pattern := "VALUE %s %d %d %d\r\n" - dest := []interface{}{&it.Key, &it.Flags, &size, &it.casid} + dest := []interface{}{&it.Key, &it.Flags, &size, &it.CasID} if bytes.Count(line, space) == 3 { pattern = "VALUE %s %d %d\r\n" dest = dest[:3] @@ -603,7 +625,7 @@ func (c *Client) populateOne(rw *bufio.ReadWriter, verb string, item *Item) erro var err error if verb == "cas" { _, err = fmt.Fprintf(rw, "%s %s %d %d %d %d\r\n", - verb, item.Key, item.Flags, item.Expiration, len(item.Value), item.casid) + verb, item.Key, item.Flags, item.Expiration, len(item.Value), item.CasID) } else { _, err = fmt.Fprintf(rw, "%s %s %d %d %d\r\n", verb, item.Key, item.Flags, item.Expiration, len(item.Value)) diff --git a/vendor/github.com/bradfitz/gomemcache/memcache/selector.go b/vendor/github.com/bradfitz/gomemcache/memcache/selector.go index 89ad81e0..964dbdb6 100644 --- a/vendor/github.com/bradfitz/gomemcache/memcache/selector.go +++ b/vendor/github.com/bradfitz/gomemcache/memcache/selector.go @@ -1,5 +1,5 @@ /* -Copyright 2011 Google Inc. +Copyright 2011 The gomemcache AUTHORS Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/modules.txt b/vendor/modules.txt index d0e70538..98814873 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -28,7 +28,7 @@ github.com/bgentry/speakeasy github.com/boombuler/barcode github.com/boombuler/barcode/qr github.com/boombuler/barcode/utils -# github.com/bradfitz/gomemcache v0.0.0-20230124162541-5f7a7d875746 +# github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 ## explicit github.com/bradfitz/gomemcache/memcache # github.com/cenkalti/backoff/v4 v4.1.3 -- GitLab