Supports MCP service configuration protocol and SNI, along with various other fixes. (#1369)

This commit is contained in:
澄潭
2024-10-09 15:54:19 +08:00
committed by GitHub
parent 3ed28f2a66
commit ecf52aecfc
23 changed files with 282 additions and 94 deletions

View File

@@ -237,7 +237,7 @@ func (w *watcher) Stop() {
// clean the cache
suffix := strings.Join([]string{serviceName, w.ConsulDatacenter, w.Type}, common.DotSeparator)
host := strings.ReplaceAll(suffix, common.Underscore, common.Hyphen)
w.cache.DeleteServiceEntryWrapper(host)
w.cache.DeleteServiceWrapper(host)
}
w.isStop = true
close(w.stop)
@@ -295,15 +295,16 @@ func (w *watcher) getSubscribeCallback(serviceName string) func(idx uint64, data
serviceEntry := w.generateServiceEntry(host, services)
if serviceEntry != nil {
log.Infof("consul update serviceEntry %s cache", host)
w.cache.UpdateServiceEntryWrapper(host, &memory.ServiceEntryWrapper{
w.cache.UpdateServiceWrapper(host, &memory.ServiceWrapper{
ServiceEntry: serviceEntry,
ServiceName: serviceName,
Suffix: suffix,
RegistryType: w.Type,
RegistryName: w.Name,
})
} else {
log.Infof("consul serviceEntry %s is nil", host)
//w.cache.DeleteServiceEntryWrapper(host)
//w.cache.DeleteServiceWrapper(host)
}
}
}