Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a96e54cd1a |
@@ -280,16 +280,16 @@ func startForwarder(t *testing.T) (string, func(addr string)) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
var (
|
var (
|
||||||
mu sync.Mutex
|
lock sync.Mutex
|
||||||
to string
|
to string
|
||||||
)
|
)
|
||||||
|
|
||||||
// dial connects to the address set, and returns nil while it is "". It
|
// dial connects to the address set, and returns nil while it is "". It
|
||||||
// holds the lock throughout, so once another address is set, nothing
|
// holds the lock throughout, so once another address is set, nothing
|
||||||
// connects to the one before.
|
// connects to the one before.
|
||||||
dial := func() net.Conn {
|
dial := func() net.Conn {
|
||||||
mu.Lock()
|
lock.Lock()
|
||||||
defer mu.Unlock()
|
defer lock.Unlock()
|
||||||
|
|
||||||
if to == "" {
|
if to == "" {
|
||||||
return nil
|
return nil
|
||||||
@@ -323,8 +323,8 @@ func startForwarder(t *testing.T) (string, func(addr string)) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
return listener.Addr().String(), func(addr string) {
|
return listener.Addr().String(), func(addr string) {
|
||||||
mu.Lock()
|
lock.Lock()
|
||||||
defer mu.Unlock()
|
defer lock.Unlock()
|
||||||
|
|
||||||
to = addr
|
to = addr
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user