From 5a80cbbbbd6f5c2e5a71b5fd6fd890729349b52d Mon Sep 17 00:00:00 2001 From: maguowei Date: Thu, 28 Sep 2023 10:06:35 +0800 Subject: [PATCH] patch https://github.com/apache/dubbo-go/pull/2384 --- config/service_config.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/config/service_config.go b/config/service_config.go index 83cb9c0699..fea7ee4a3f 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -210,7 +210,12 @@ func (s *ServiceConfig) IsExport() bool { func getRandomPort(protocolConfigs []*ProtocolConfig) *list.List { ports := list.New() for _, proto := range protocolConfigs { - if len(proto.Port) > 0 { + if port, err := strconv.Atoi(proto.Port); err != nil { + logger.Infof( + "%s will be assgined to a random port, since the port is an invalid number", + proto.Name, + ) + } else if port > 0 { continue } @@ -331,13 +336,13 @@ func (s *ServiceConfig) Export() error { return nil } -//setRegistrySubURL set registry sub url is ivkURl +// setRegistrySubURL set registry sub url is ivkURl func setRegistrySubURL(ivkURL *common.URL, regUrl *common.URL) { ivkURL.AddParam(constant.RegistryKey, regUrl.GetParam(constant.RegistryKey, "")) regUrl.SubURL = ivkURL } -//loadProtocol filter protocols by ids +// loadProtocol filter protocols by ids func loadProtocol(protocolIds []string, protocols map[string]*ProtocolConfig) []*ProtocolConfig { returnProtocols := make([]*ProtocolConfig, 0, len(protocols)) for _, v := range protocolIds {