tplimpl: Fix data race in resGetResource

Fixes #3045
This commit is contained in:
Bjørn Erik Pedersen 2017-02-17 14:24:56 +01:00
parent 77cbe4d60b
commit 4b3ca38b2e

View file

@ -49,8 +49,8 @@ func (l *remoteLock) URLLock(url string) {
if _, ok := l.m[url]; !ok { if _, ok := l.m[url]; !ok {
l.m[url] = &sync.Mutex{} l.m[url] = &sync.Mutex{}
} }
l.Unlock() // call this Unlock before the next lock will be called. NFI why but defer doesn't work.
l.m[url].Lock() l.m[url].Lock()
l.Unlock()
} }
// URLUnlock unlocks an URL when the download has been finished. Use only in defer calls. // URLUnlock unlocks an URL when the download has been finished. Use only in defer calls.