Skip to content

Commit

Permalink
fix #2758, findMappedServices panic (#2768)
Browse files Browse the repository at this point in the history
* fix #2758, findMappedServices panic

* update: run go fmt

---------

Co-authored-by: zhangcunli <[email protected]>
  • Loading branch information
zhangcunli and zhangcunli authored Dec 27, 2024
1 parent cade298 commit 8f9a47a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions registry/servicediscovery/service_discovery_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,20 @@ 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 8f9a47a

Please sign in to comment.