Skip to content

Commit

Permalink
fix apache#2758, findMappedServices panic
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangcunli committed Dec 23, 2024
1 parent ea32b5d commit 4f68e26
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions registry/servicediscovery/service_discovery_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,21 @@ func (s *serviceDiscoveryRegistry) findMappedServices(url *common.URL, listener
}
if listener != nil {
protocolServiceKey := url.ServiceKey() + ":" + url.Protocol
s.lock.Lock()
s.serviceMappingListeners[protocolServiceKey] = listener
s.lock.Unlock()
}
return serviceNames
}

func (s *serviceDiscoveryRegistry) stopListen(url *common.URL) {
protocolServiceKey := url.ServiceKey() + ":" + url.Protocol
s.lock.Lock()
listener := s.serviceMappingListeners[protocolServiceKey]
if listener != nil {
delete(s.serviceMappingListeners, protocolServiceKey)
listener.Stop()
}
s.lock.Unlock()
}

0 comments on commit 4f68e26

Please sign in to comment.