mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 10:00:25 +08:00
修复UserAgent分析可能产生的死锁
This commit is contained in:
@@ -68,6 +68,8 @@ func (this *UserAgentParser) Parse(userAgent string) (result UserAgentParserResu
|
|||||||
this.locker.RUnlock()
|
this.locker.RUnlock()
|
||||||
|
|
||||||
this.locker.Lock()
|
this.locker.Lock()
|
||||||
|
defer this.locker.Unlock()
|
||||||
|
|
||||||
this.parser.Parse(userAgent)
|
this.parser.Parse(userAgent)
|
||||||
result.OS = this.parser.OSInfo()
|
result.OS = this.parser.OSInfo()
|
||||||
result.BrowserName, result.BrowserVersion = this.parser.Browser()
|
result.BrowserName, result.BrowserVersion = this.parser.Browser()
|
||||||
@@ -95,7 +97,6 @@ func (this *UserAgentParser) Parse(userAgent string) (result UserAgentParserResu
|
|||||||
this.cacheMap1 = map[string]UserAgentParserResult{}
|
this.cacheMap1 = map[string]UserAgentParserResult{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.locker.Unlock()
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user