summaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/appengine/internal/net.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-25 19:00:14 +0100
committerGitHub <noreply@github.com>2021-02-25 19:00:14 +0100
commitb220d6cd06360d6b868cd7fb7c32d2602aab69a5 (patch)
tree6777cc2c23306d1a6b87ef40b9fe4eab2764b7dd /vendor/google.golang.org/appengine/internal/net.go
parent9ec8106841c55bc085012727748e2d73826be97d (diff)
parent24d9bda7ff8a3e6a9f249401e05e35e73284ae61 (diff)
downloadpodman-b220d6cd06360d6b868cd7fb7c32d2602aab69a5.tar.gz
podman-b220d6cd06360d6b868cd7fb7c32d2602aab69a5.tar.bz2
podman-b220d6cd06360d6b868cd7fb7c32d2602aab69a5.zip
Merge pull request #9518 from baude/pruneremotecommand
prune remotecommand dependency
Diffstat (limited to 'vendor/google.golang.org/appengine/internal/net.go')
-rw-r--r--vendor/google.golang.org/appengine/internal/net.go56
1 files changed, 0 insertions, 56 deletions
diff --git a/vendor/google.golang.org/appengine/internal/net.go b/vendor/google.golang.org/appengine/internal/net.go
deleted file mode 100644
index fe429720e..000000000
--- a/vendor/google.golang.org/appengine/internal/net.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2014 Google Inc. All rights reserved.
-// Use of this source code is governed by the Apache 2.0
-// license that can be found in the LICENSE file.
-
-package internal
-
-// This file implements a network dialer that limits the number of concurrent connections.
-// It is only used for API calls.
-
-import (
- "log"
- "net"
- "runtime"
- "sync"
- "time"
-)
-
-var limitSem = make(chan int, 100) // TODO(dsymonds): Use environment variable.
-
-func limitRelease() {
- // non-blocking
- select {
- case <-limitSem:
- default:
- // This should not normally happen.
- log.Print("appengine: unbalanced limitSem release!")
- }
-}
-
-func limitDial(network, addr string) (net.Conn, error) {
- limitSem <- 1
-
- // Dial with a timeout in case the API host is MIA.
- // The connection should normally be very fast.
- conn, err := net.DialTimeout(network, addr, 10*time.Second)
- if err != nil {
- limitRelease()
- return nil, err
- }
- lc := &limitConn{Conn: conn}
- runtime.SetFinalizer(lc, (*limitConn).Close) // shouldn't usually be required
- return lc, nil
-}
-
-type limitConn struct {
- close sync.Once
- net.Conn
-}
-
-func (lc *limitConn) Close() error {
- defer lc.close.Do(func() {
- limitRelease()
- runtime.SetFinalizer(lc, nil)
- })
- return lc.Conn.Close()
-}