Get rid of un-needed lock

This commit is contained in:
Tim Hockin 2014-09-20 11:40:02 -07:00
parent a559d8d9b2
commit dd9c562769

View File

@ -347,15 +347,10 @@ func (proxier *Proxier) setServiceInfo(service string, info *serviceInfo) {
proxier.serviceMap[service] = info proxier.serviceMap[service] = info
} }
// used to globally lock around unused ports. Only used in testing.
var unusedPortLock sync.Mutex
// addServiceOnUnusedPort starts listening for a new service, returning the // addServiceOnUnusedPort starts listening for a new service, returning the
// port it's using. For testing on a system with unknown ports used. The timeout only applies to UDP // port it's using. For testing on a system with unknown ports used. The timeout only applies to UDP
// connections, for now. // connections, for now.
func (proxier *Proxier) addServiceOnUnusedPort(service, protocol string, timeout time.Duration) (string, error) { func (proxier *Proxier) addServiceOnUnusedPort(service, protocol string, timeout time.Duration) (string, error) {
unusedPortLock.Lock()
defer unusedPortLock.Unlock()
sock, err := newProxySocket(protocol, proxier.address, 0) sock, err := newProxySocket(protocol, proxier.address, 0)
if err != nil { if err != nil {
return "", err return "", err