mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-11 09:06:14 +00:00
Updates godep for etcd-client to 3.1.10.
This commit is contained in:
56
vendor/github.com/coreos/etcd/integration/bridge.go
generated
vendored
56
vendor/github.com/coreos/etcd/integration/bridge.go
generated
vendored
@@ -31,8 +31,9 @@ type bridge struct {
|
||||
l net.Listener
|
||||
conns map[*bridgeConn]struct{}
|
||||
|
||||
stopc chan struct{}
|
||||
wg sync.WaitGroup
|
||||
stopc chan struct{}
|
||||
pausec chan struct{}
|
||||
wg sync.WaitGroup
|
||||
|
||||
mu sync.Mutex
|
||||
}
|
||||
@@ -43,8 +44,11 @@ func newBridge(addr string) (*bridge, error) {
|
||||
inaddr: addr + "0",
|
||||
outaddr: addr,
|
||||
conns: make(map[*bridgeConn]struct{}),
|
||||
stopc: make(chan struct{}, 1),
|
||||
stopc: make(chan struct{}),
|
||||
pausec: make(chan struct{}),
|
||||
}
|
||||
close(b.pausec)
|
||||
|
||||
l, err := transport.NewUnixListener(b.inaddr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("listen failed on socket %s (%v)", addr, err)
|
||||
@@ -59,10 +63,13 @@ func (b *bridge) URL() string { return "unix://" + b.inaddr }
|
||||
|
||||
func (b *bridge) Close() {
|
||||
b.l.Close()
|
||||
b.mu.Lock()
|
||||
select {
|
||||
case b.stopc <- struct{}{}:
|
||||
case <-b.stopc:
|
||||
default:
|
||||
close(b.stopc)
|
||||
}
|
||||
b.mu.Unlock()
|
||||
b.wg.Wait()
|
||||
}
|
||||
|
||||
@@ -75,6 +82,22 @@ func (b *bridge) Reset() {
|
||||
b.conns = make(map[*bridgeConn]struct{})
|
||||
}
|
||||
|
||||
func (b *bridge) Pause() {
|
||||
b.mu.Lock()
|
||||
b.pausec = make(chan struct{})
|
||||
b.mu.Unlock()
|
||||
}
|
||||
|
||||
func (b *bridge) Unpause() {
|
||||
b.mu.Lock()
|
||||
select {
|
||||
case <-b.pausec:
|
||||
default:
|
||||
close(b.pausec)
|
||||
}
|
||||
b.mu.Unlock()
|
||||
}
|
||||
|
||||
func (b *bridge) serveListen() {
|
||||
defer func() {
|
||||
b.l.Close()
|
||||
@@ -91,13 +114,23 @@ func (b *bridge) serveListen() {
|
||||
if ierr != nil {
|
||||
return
|
||||
}
|
||||
b.mu.Lock()
|
||||
pausec := b.pausec
|
||||
b.mu.Unlock()
|
||||
select {
|
||||
case <-b.stopc:
|
||||
inc.Close()
|
||||
return
|
||||
case <-pausec:
|
||||
}
|
||||
|
||||
outc, oerr := net.Dial("unix", b.outaddr)
|
||||
if oerr != nil {
|
||||
inc.Close()
|
||||
return
|
||||
}
|
||||
|
||||
bc := &bridgeConn{inc, outc}
|
||||
bc := &bridgeConn{inc, outc, make(chan struct{})}
|
||||
b.wg.Add(1)
|
||||
b.mu.Lock()
|
||||
b.conns[bc] = struct{}{}
|
||||
@@ -108,6 +141,7 @@ func (b *bridge) serveListen() {
|
||||
|
||||
func (b *bridge) serveConn(bc *bridgeConn) {
|
||||
defer func() {
|
||||
close(bc.donec)
|
||||
bc.Close()
|
||||
b.mu.Lock()
|
||||
delete(b.conns, bc)
|
||||
@@ -119,21 +153,29 @@ func (b *bridge) serveConn(bc *bridgeConn) {
|
||||
wg.Add(2)
|
||||
go func() {
|
||||
io.Copy(bc.out, bc.in)
|
||||
bc.close()
|
||||
wg.Done()
|
||||
}()
|
||||
go func() {
|
||||
io.Copy(bc.in, bc.out)
|
||||
bc.close()
|
||||
wg.Done()
|
||||
}()
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
type bridgeConn struct {
|
||||
in net.Conn
|
||||
out net.Conn
|
||||
in net.Conn
|
||||
out net.Conn
|
||||
donec chan struct{}
|
||||
}
|
||||
|
||||
func (bc *bridgeConn) Close() {
|
||||
bc.close()
|
||||
<-bc.donec
|
||||
}
|
||||
|
||||
func (bc *bridgeConn) close() {
|
||||
bc.in.Close()
|
||||
bc.out.Close()
|
||||
}
|
||||
|
||||
4
vendor/github.com/coreos/etcd/integration/cluster.go
generated
vendored
4
vendor/github.com/coreos/etcd/integration/cluster.go
generated
vendored
@@ -532,7 +532,9 @@ func (m *member) electionTimeout() time.Duration {
|
||||
return time.Duration(m.s.Cfg.ElectionTicks) * time.Millisecond
|
||||
}
|
||||
|
||||
func (m *member) DropConnections() { m.grpcBridge.Reset() }
|
||||
func (m *member) DropConnections() { m.grpcBridge.Reset() }
|
||||
func (m *member) PauseConnections() { m.grpcBridge.Pause() }
|
||||
func (m *member) UnpauseConnections() { m.grpcBridge.Unpause() }
|
||||
|
||||
// NewClientV3 creates a new grpc client connection to the member
|
||||
func NewClientV3(m *member) (*clientv3.Client, error) {
|
||||
|
||||
Reference in New Issue
Block a user