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