mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-01-07 20:59:24 +08:00
修复查找域名对应服务时可能造成的死锁
This commit is contained in:
@@ -157,6 +157,7 @@ func (this *ServerAddressGroup) MatchServerName(serverName string) *ServerConfig
|
||||
if ok {
|
||||
server, ok := domainMap[serverName]
|
||||
if ok {
|
||||
this.cacheLocker.RUnlock()
|
||||
return server
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,10 @@ func TestServerAddressGroup_MatchServerName(t *testing.T) {
|
||||
for i := 0; i < 100_000; i++ {
|
||||
_ = group.MatchServerName("world.hello.com")
|
||||
}
|
||||
|
||||
// 检查死锁问题
|
||||
group.MatchServerName("world2.hello.com")
|
||||
|
||||
}
|
||||
|
||||
func TestServerAddressGroup_MatchServerCNAME(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user